Please help, any response is greatly appreciated 
Author Message
 Please help, any response is greatly appreciated

Hi

I have several entries on the GUI that I wrote using tcl/tk8.0 and I
want to set a default value for each of those entries.  How should I set
those default values?

should I do this, for example

set entry1 54
set entry2 100
set entry3 C:/project/file3
......

if I do this will I be able to take in the new values that the user
enters(if user does not want my default value) and replace the default
values that are in those entries originally?  

Also when I try to open "file3" in notepad by creating a proc that
contains this command:
....
exec notepad "$entry3"
....

I'd get an error message saying that can't read "entry3": no such
variable.  I think the reason is that I did not declare entry3
correctly.  Should I declare it globally?  

Please help.  I am very new to this language therefore any responses
will be greatly appreciated.
Thanks
David



Mon, 11 Dec 2000 03:00:00 GMT  
 Please help, any response is greatly appreciated

Hello,

The problem is quit simple you have declared global varaibles.
If you want to acces global Variables inside a procedure you have
to decleare the variable inside the procedure as global like this.

set entry1 "test"
puts $entry1
# correct
proc  test { } {

        puts $entry1
        # ERROR variable unknown,

        global entry1
        puts $entry1
        # correct

Quote:
}

Short but i hope it will help.

Sven



Tue, 12 Dec 2000 03:00:00 GMT  
 Please help, any response is greatly appreciated

Quote:

> I have several entries on the GUI that I wrote using tcl/tk8.0 and I
> want to set a default value for each of those entries.  How should I set
> those default values?

> should I do this, for example

> set entry1 54
> set entry2 100
> set entry3 C:/project/file3
> ......

> if I do this will I be able to take in the new values that the user
> enters(if user does not want my default value) and replace the default
> values that are in those entries originally?

Your question gives very little information on how you're using the
values in your GUI.  Are you using Entry widgets to allow the user
to type in new values?  In which case, simply use the -textvariable
option, eg:

        set entry1 54
        entry .entry1 -textvariable entry1

Quote:
> Also when I try to open "file3" in notepad by creating a proc that
> contains this command:
> ....
> exec notepad "$entry3"
> ....

> I'd get an error message saying that can't read "entry3": no such
> variable.  I think the reason is that I did not declare entry3
> correctly.  Should I declare it globally?

Again, not enough information.  Is the exec command being executed in
a procedure?  In that case you may well have to declare the variable to
be global.

HTHs,
Steve Ball



Wed, 13 Dec 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Your help will be greatly appreciated...

2. ODBC hassles, any help greatly appreciated.

3. Newbie question, help greatly appreciated.

4. Help would be greatly appreciated...

5. Suggestions greatly appreciated

6. Please help, any info will be greatly received - re: Invisible Canvas

7. Help with a view PLEASE I am using CW2003 and compiling in 32bit

8. I am v. stupid, please help

9. how to make a record work??? any help would be greatly appreciated

10. Please I would appreciate some input, Far pointer from C++ to asm

11. please, please, please, please, help

12. will someone please, please, please, please HELP me?!!

 

 
Powered by phpBB® Forum Software