[GiDlist] TCL-TK procedure

Moderator: GiD Team

Post Reply
Mark Smith

[GiDlist] TCL-TK procedure

Post by Mark Smith »

(gid 6.3.0b win2000)

Hi GiD team

Question 1: I have a tcl module in my problemtype & I am getting some
strange behaviour. When I execute an external program I pipe out the stdout
to a file whose full path & name is held in infoP the procedure below opens
a window & displays the file contents when the process has completed. The
first time this executes everything is OK but if I run the process again the
infowindow appears the full size of the screen. If I reload the problem type
& re run the same thing happens it's full size, I need to close Gid &
relaunch it to get the window to behave properly. Is this a bug or is there
a fix ?

proc CreateWindow {dir msg infoP} {
set w .gid.infowin

InitWindow $w "Info window for $infoP" datawin
frame $w.top
pack $w.top -pady 10 -padx 10

set t [text $w.top.t -setgrid true -wrap word \
-width 80 -height 30 -yscrollcommand "$w.top.sy set"]
scrollbar $w.top.sy -orient vert -command "$w.top.t yview"
pack $w.top.sy -side right -fill y
pack $w.top.t -side left -fill both -expand true

frame $w.bottom
button $w.bottom.leave -text "close" \
-height 1 -width 14 -command "destroy $w" -bg PaleGoldenrod
pack $w.bottom.leave -pady 2
pack $w.bottom

set f [open $infoP r]
while {[gets $f inln] !=-1} {
set txln "$inln\n"
$w.top.t insert end $txln
}
close $f
}



Question 2: Are there any other parameters to the gid tcl call WarnWinText
other than the text string to be displayed i.e. can I specify the window
size & position etc ?

Question 3: similar to 2, how can I specify the position of the window
created by the procedure CreateWindow above ?

Thank in advance
Best regards
Mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003



The information contained in this e-mail message (and any attachment
transmitted herewith) is privileged and confidential and is intended for the
exclusive use of the addressee(s). If you are not an addressee, any
disclosure, reproduction, distribution or other dissemination or use of this
communication is strictly prohibited. If you have received this
communication in error, please contact us immediately so that we can correct
the error.
Jorge Suit Perez Ronda

[GiDlist] TCL-TK procedure

Post by Jorge Suit Perez Ronda »

Hi, in your script when you set -setgrid to true in the text $w.top.t
then the toplevel geometry (containing the text) will be handled (by wm)
in grid units instead of pixels units. One of the things InitWindow does
is setting the geometry of the window to the last geometry saved. The
last geometry saved is the one before the toplevel is being destroyed
and when the toplevel is being destroyed the geometry is given in pixels
because the text widget had being already destroyed (all children are
destroyed before the toplevel). So, remove the option -setgrid (or set
it to false) if you want to manage the toplevel with InitWindow. See wm
geometry in the tcl/tk documentation to see how to position a toplevel
window.

best regards,

Jorge Suit

Mark Smith wrote:

(gid 6.3.0b win2000)

Hi GiD team

Question 1: I have a tcl module in my problemtype & I am getting some
strange behaviour. When I execute an external program I pipe out the stdout
to a file whose full path & name is held in infoP the procedure below opens
a window & displays the file contents when the process has completed. The
first time this executes everything is OK but if I run the process again the
infowindow appears the full size of the screen. If I reload the problem type
& re run the same thing happens it's full size, I need to close Gid &
relaunch it to get the window to behave properly. Is this a bug or is there
a fix ?

proc CreateWindow {dir msg infoP} {
set w .gid.infowin

InitWindow $w "Info window for $infoP" datawin
frame $w.top
pack $w.top -pady 10 -padx 10

set t [text $w.top.t -setgrid true -wrap word \
-width 80 -height 30 -yscrollcommand "$w.top.sy set"]
scrollbar $w.top.sy -orient vert -command "$w.top.t yview"
pack $w.top.sy -side right -fill y
pack $w.top.t -side left -fill both -expand true

frame $w.bottom
button $w.bottom.leave -text "close" \
-height 1 -width 14 -command "destroy $w" -bg PaleGoldenrod
pack $w.bottom.leave -pady 2
pack $w.bottom

set f [open $infoP r]
while {[gets $f inln] !=-1} {
set txln "$inln\n"
$w.top.t insert end $txln
}
close $f
}



Question 2: Are there any other parameters to the gid tcl call WarnWinText
other than the text string to be displayed i.e. can I specify the window
size & position etc ?

Question 3: similar to 2, how can I specify the position of the window
created by the procedure CreateWindow above ?

Thank in advance
Best regards
Mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003



The information contained in this e-mail message (and any attachment
transmitted herewith) is privileged and confidential and is intended for the
exclusive use of the addressee(s). If you are not an addressee, any
disclosure, reproduction, distribution or other dissemination or use of this
communication is strictly prohibited. If you have received this
communication in error, please contact us immediately so that we can correct
the error.
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist




Enrique Escolano

[GiDlist] TCL-TK procedure

Post by Enrique Escolano »

If you use InitWindow, then GiD automatically store variables with some
Window properties,
Can create directly a toplevel without use this InitWindow procedure, or
unset GidPriv(datawin) ("datawin" is your own InitWindow parameter) when
your window is destroyed:

-command "destroy $w ; catch { unset GidPriv(datawin) }"

Can set the size/location of any Tk window. Read more about "wm geometry"
Tcl/Tk command
for example:
wm geometry .gid.infowin 70x30+0+0

Enrique Escolano

----- Original Message -----
From: "Mark Smith" mark.smith at linx.co.uk
To: "Gidlist (E-mail)" gidlist at gatxan.cimne.upc.es
Sent: Friday, September 12, 2003 2:09 PM
Subject: [GiDlist] TCL-TK procedure


(gid 6.3.0b win2000)

Hi GiD team

Question 1: I have a tcl module in my problemtype & I am getting some
strange behaviour. When I execute an external program I pipe out the
stdout
to a file whose full path & name is held in infoP the procedure below
opens
a window & displays the file contents when the process has completed. The
first time this executes everything is OK but if I run the process again
the
infowindow appears the full size of the screen. If I reload the problem
type
& re run the same thing happens it's full size, I need to close Gid &
relaunch it to get the window to behave properly. Is this a bug or is
there
a fix ?

proc CreateWindow {dir msg infoP} {
set w .gid.infowin

InitWindow $w "Info window for $infoP" datawin
frame $w.top
pack $w.top -pady 10 -padx 10

set t [text $w.top.t -setgrid true -wrap word \
-width 80 -height 30 -yscrollcommand "$w.top.sy set"]
scrollbar $w.top.sy -orient vert -command "$w.top.t yview"
pack $w.top.sy -side right -fill y
pack $w.top.t -side left -fill both -expand true

frame $w.bottom
button $w.bottom.leave -text "close" \
-height 1 -width 14 -command "destroy $w" -bg PaleGoldenrod
pack $w.bottom.leave -pady 2
pack $w.bottom

set f [open $infoP r]
while {[gets $f inln] !=-1} {
set txln "$inln\n"
$w.top.t insert end $txln
}
close $f
}



Question 2: Are there any other parameters to the gid tcl call
WarnWinText
other than the text string to be displayed i.e. can I specify the window
size & position etc ?

Question 3: similar to 2, how can I specify the position of the window
created by the procedure CreateWindow above ?

Thank in advance
Best regards
Mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003



The information contained in this e-mail message (and any attachment
transmitted herewith) is privileged and confidential and is intended for
the
exclusive use of the addressee(s). If you are not an addressee, any
disclosure, reproduction, distribution or other dissemination or use of
this
communication is strictly prohibited. If you have received this
communication in error, please contact us immediately so that we can
correct
the error.
_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist

Post Reply