newLISP Fan Club

Forum => newLISP in the real world => Topic started by: tom on July 15, 2006, 05:14:14 AM

Title: tk entry field?
Post by: tom on July 15, 2006, 05:14:14 AM
howdy guys,



I have modified tcltk.lsp (distributed with newlisp) so

that I get this when I run it.



(//%3C/s%3E%3CURL%20url=%22http://perpetualnewbie.info/pix/snapshot1.png%22%3Ehttp://perpetualnewbie.info/pix/snapshot1.png%3C/URL%3E%3Ce%3E)



Very impressive, isn't it?  Now, if only I could use

the string I type!  I have tried various ugly things,

with no luck.  Any suggestions?



Thanks.
Title:
Post by: Fanda on July 16, 2006, 09:46:21 AM
I used newlisp-tk for running, but it shows the example:


;;
;; Tk entry widget test
;;

; window
(tk "toplevel .w")
(tk "wm title .w {Test}")

; entry
(tk "set ::entry_string {Type something here ;-)}")
(tk "entry .w.e -width 30 -textvariable ::entry_string")
(tk "pack .w.e")

; button
(tk "frame .w.buttons")
(tk "pack .w.buttons -side bottom -fill x -pady 2m")

(tk "button .w.buttons.show -text {Show text} -command {Newlisp {(show)}}")
(tk "pack .w.buttons.show -side left -expand 1")


; show Tk message box and print the string in newLISP
(define (show)
  (silent (tk {tk_messageBox -parent .w -title "Your text" -message "Text: $::entry_string" -type ok -icon info}))
  (println "Text: " (tk "set ::entry_string")))


Fanda