Click to See Complete Forum and Search --> : Tcl/Tk Wish


Architect
01-20-2005, 08:11 AM
Is there any way we can use the 'test' function in Tk programs?
I want to write a function that tests if a file is a file/directory in Tk/Wish.
Does anyone have any good ref docs for Tk/Wish?

Architect
01-20-2005, 09:22 AM
I have a problem with my script i do not get the scrollbar on the left of the frame where i want it. Instead it goes to the left of the window itself. My code is shown below.
Can anyone see whats wrong with it?
# The Directory Listing Frame
frame .lclListFrame -relief raised -bd 2
# The File ListBox
listbox .lclListFrame.lclFileList -width 30 -height 30 -yscroll ".lclListFrame.lclFileListScroll set"

# The Scrollbar for the ListBox
scrollbar .lclListFrame.lclFileListScroll -command ".lclListFrame.lclFileList yview"

# Pack all of them so that they are seen on the screen
pack .lclListFrame.lclFileList -side left
pack .lclListFrame.lclFileListScroll -side right

pack .lclListFrame -fill x
# End of the Directory Listing Frame

I also would like to know how to position widgets with respect to eac other.
I mean I need to place it like this
A Label and A Textbox on the first line
below which should come A Listbox and A Scrollbar (attached to the ListBox).
How can this be done?

Architect
01-21-2005, 08:00 AM
Solved it I created a nested hierarchy of frames.
And was able to place them and pack as desired.

Architect
01-21-2005, 08:57 AM
I have another problem with variables now.
I have 2 global variables (string) and want to have a common procedure to update any one of the variabels depending on the arguments passed.
I pass the global variable that i need as an argument and then using 'upvar' try to change it in the procedure but it does not happen.
Any idea how this is done?

bwkaz
01-21-2005, 08:16 PM
I don't know much about Tcl, but in most other languages I'd pass the variable by reference if I needed changes made in the called function to take effect in the caller.

I'm not sure how to do that in Tcl, but maybe Googling for "pass by reference" tcl would give some good results?

Architect
01-21-2005, 11:03 PM
Yeah we need to pass the variable by reference and Tcl uses the 'upvar' command for this. My problem is that this does not work I dont know why?

<edit>
Actually to be more precise I can acces the variables values but i cannot modify the value inside the proc.
Does anyone know how to do this?
</edit>

Architect
01-22-2005, 06:54 AM
Slightly Off topic, is there any way to separate the TK script code in separate files and include them together in some way.
I mean i want the framework (GUI) script and the real code to be in separate files.
Any way of doing this?

Architect
01-23-2005, 05:52 AM
Guess not huh?

bwkaz
01-23-2005, 03:18 PM
Not that I know of. But I know very little Tcl...

Architect
01-23-2005, 11:20 PM
Is there nothing like the C equivalent of #include?

Architect
01-24-2005, 10:13 AM
LHow do i handle a socket connection to a erroneous port on a machine in Tcl?
Right now my code crashes when i try to connect to a disallowed port. Instead i want to display a message saying that the connection failed from my app.
How can i do this?

Posted this as a separate thread here http://justlinux.com/forum/showthread.php?s=&threadid=137436