newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: HPW on October 25, 2003, 01:41:37 PM

Title: Window pos from config-file
Post by: HPW on October 25, 2003, 01:41:37 PM
When you start newlisp several times it pop up on different locations.

Not so nice.



Modifying newlisp-tk.tcl helps:



Add to global vars:



set Ide(WinPosX)            "+100"
set Ide(WinPosY)            "+50"


Add to proc Setupconsole



wm title . $IDEversion      #Behind this line
wm geometry . $Ide(WinPosX)$Ide(WinPosY)


Then wrapp it. The next time you save the settings the new Property appear in the config-file. There you can set them without wrapping.

A plus-sign in front of the value indicates a distance from the left (top) and a minus-sign from the right (bottom).

Setting to an empty string bring back the old behaviour.





Still want to know how to read and set TK-variables from lisp?
Title:
Post by: Lutz on October 26, 2003, 04:37:03 AM
Thanks 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.



Today I am trying to concentrate on newLISP itself and advance the non-graphical aspects of it.



Lutz
Title:
Post by: HPW on November 12, 2003, 12:03:29 AM
With this modified proc the pos is stored when you save the settings.


proc SaveSettings {} {

global Ide txt statusText

set posxprefix "+"
set posyprefix "+"

set Ide(WinPosX) [append posxprefix [winfo x .]]
set Ide(WinPosY) [append posyprefix [winfo y .]]

set initFile [open "newlisp-tk.config" w]

puts $initFile "# newlisp-tk.config - newLISP Tcl/Tk configuration file"
puts $initFile "#"
puts $initFile {# This file is generated by menu "Options/Save settings"}
puts $initFile "#n"

foreach idx [lsort [array names Ide]] {
puts $initFile "set Ide($idx) "$Ide($idx)""
}

close $initFile

set statusText {Saved settings in intcalc.config}
}
Title:
Post by: Lutz on November 12, 2003, 05:03:30 AM
thankyou , I will put this in the next version



Lutz
Title:
Post by: Lutz on November 12, 2003, 06:11:44 AM
we can just do:



set Ide(WinPosX) [winfo x .]
set Ide(WinPosY) [winfo y .]

// and when displaying:

wm geometry . +$Ide(WinPosX)+$Ide(WinPosY)


saves a little bit of code



Lutz
Title:
Post by: HPW on November 12, 2003, 07:18:50 AM
Thanks for it!



By the way:



set Ide(Console....



In my own special main-tcl I have changed all first chars of the

Ide-var-names to capital letters, because they are sorted by

them when it save the config. This is case-sensitive and so

I get a  clean alpha-sort when all are capital letters.



But it's just cosmetic. :-)