How to access a TK-variable from newlisp?

Started by HPW, October 24, 2003, 11:38:35 PM

Previous topic - Next topic

HPW

I want to access TK-variables


> (tk "set test 123")
"123"
> (tk "set test")

>


When I do the second I get a message window 'can't read "test": no such variable'. On a native TCL-console it works in that way. It respond with the content of the variable. Would be usefull to access all the global vars 'Ide(xxxxxxx)'



Any hints?
Hans-Peter

HPW

#1
QuoteThanks for posting all these improvements in the Tcl.Tk code. About setting variables in Tcl/Tk: I just try to avoid it and work with the return values from the 'tk' statement stored in LISP variables.



To declare Tcl variables from newLISP, I think you would have to create a child interpreter. But I never went much into Tcl/Tk and newlisp-tk.tcl is the only program in Tcl/Tk I have ever written.




I have only used the 'tk' call. And I want not declare them, I want read and write to existing vars. Ok my test was a new var, but it also works not with the existing one's from the config-file.
Hans-Peter

Lutz

#2
try this:



(tk "global Ide; set Ide(fontSize)")



or this:



(tk "global Ide; set Ide(fontSize) 16")



Then open a editor/browser window ;)



Lutz

HPW

#3
Lutz,



thanks for the hint.

I had thought that it could be a problem with the scope of the vars.

I had tried around, but with no satisfying solution.

So this is short and easy.

Fits very good in the concept of newlisp. :-)
Hans-Peter