home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
asciiprint.tcl
< prev
next >
Wrap
Text File
|
1996-11-19
|
4KB
|
136 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)asciiprint.tcl /main/titanic/3
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)asciiprint.tcl /main/titanic/3 19 Nov 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require "wmt_util.tcl"
# End user added include file section
Class AsciiPrinterDlg : {TemplateDialog} {
method destructor
constructor
method handleCancel
method handleHelp
method handleOk
method length
method lengthModified
attribute llenPrev
attribute plenPrev
attribute cmdField
attribute llenField
attribute plenField
attribute options
}
method AsciiPrinterDlg::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor AsciiPrinterDlg {class this name} {
set this [TemplateDialog::constructor $class $this $name]
interface DlgColumn $this.top {
NamedGroup printer {
label "Text Printer"
mnemonic "A"
DlgColumn prView {
Label cmdLabel {
text "Printer Command"
}
SingleLineText cmdField {}
Label llenLabel {
text "Line Length"
}
IntField llenField {}
Label plenLabel {
text "Page Length"
}
IntField plenField {}
}
}
}
$this config \
-modal yes \
-autoPopDown no \
-title "Printer Setup" \
-cmdField $this.top.printer.prView.cmdField \
-llenField $this.top.printer.prView.llenField \
-plenField $this.top.printer.prView.plenField \
-okPressed "$this handleOk" \
-cancelPressed "$this handleCancel" \
-helpPressed "$this handleHelp"
[$this cmdField] text [m4_var get M4_a_printer]
$this length l [m4_var get M4_a_printer_llen]
$this length p [m4_var get M4_a_printer_plen]
[$this llenField] textModified "$this lengthModified l"
[$this plenField] textModified "$this lengthModified p"
return $this
}
method AsciiPrinterDlg::handleCancel {this} {
$this delete
}
method AsciiPrinterDlg::handleHelp {this} {
if [catch {[getParent $this] helpOnName [nt_get_type $this]}] {
showHelp GEN/m_prsu.html#dialogbox
}
}
method AsciiPrinterDlg::handleOk {this} {
set options [$this options]
set dim ""
if {[$this length l] <= 0} {
set dim l
} elseif {[$this length p] <= 0} {
set dim p
}
if {"$dim" != ""} {
set fieldName [$this.top.printer.prView.${dim}lenLabel text]
wmtkerror "$fieldName must be a positive value"
return
}
if {"[m4_var get M4_a_printer]" != "[[$this cmdField] text]"} {
catch {m4_var set M4_a_printer [[$this cmdField] text]}
}
if {[m4_var get M4_a_printer_llen] != [$this length l]} {
catch {m4_var set M4_a_printer_llen [$this length l]}
}
if {[m4_var get M4_a_printer_plen] != [$this length p]} {
catch {m4_var set M4_a_printer_plen [$this length p]}
}
$this popDown
$this delete
}
method AsciiPrinterDlg::length {this dim {num ,}} {
if {$num == ","} {
return [[$this ${dim}lenField] intValue]
}
[$this ${dim}lenField] intValue $num
$this ${dim}lenPrev $num
}
method AsciiPrinterDlg::lengthModified {this dim} {
if {[$this length $dim] >= 0} {
$this ${dim}lenPrev [[$this ${dim}lenField] text]
} else {
set cursorIndex [[$this ${dim}lenField] cursorIndex]
[$this ${dim}lenField] text [$this ${dim}lenPrev]
[$this ${dim}lenField] cursorIndex [expr $cursorIndex - 1]
}
}
# Do not delete this line -- regeneration end marker