Page 1 of 1

tk entry field?

Posted: Sat Jul 15, 2006 12:14 pm
by tom
howdy guys,

I have modified tcltk.lsp (distributed with newlisp) so
that I get this when I run it.

Image

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.

Posted: Sun Jul 16, 2006 4:46 pm
by Fanda
I used newlisp-tk for running, but it shows the example:

Code: Select all

;;
;; 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