Console window in custom-application?
Console window in custom-application?
A nice feature would be to intergrate a console window in our own TK-Frontend. Like a listener-object in common-lisp, it would allow to output a command-log and input lisp-direct calls. Yes, sounds like an autocad command-line (Teach an old horse somthing new). Would be an subset of the newlisp-TK main-window logic. Command-promt should be configurable, so instead of "> " we can make "command: " or "Befehl: ". Also size and position should be configurable through TK. Sample would be very wellcomed for Tips and Tricks!!
Hans-Peter
Get a book about Tcl/Tk programming and look into the examples in the distribution, how to make callbacks from Tcl/Tk into newLISP. Here is something to get you started:
a window comes up and you type something in and hit <enter>, it comes back in uppercase (works only once, and I din't want to spend more time on it).
Lutz
Code: Select all
(context 'EDIT)
(define (edit )
(tk "if {[winfo exists .ewin] == 1} {destroy .ewin}")
(tk "toplevel .ewin")
(tk "text .ewin.edit -width 60 -height 10")
(tk "pack .ewin.edit")
(tk "bind .ewin.edit <Return> {Newlisp {(silent (EDIT:getEditText))}}")
(tk "update idletasks"))
(define (getEditText )
(set 'text (tk ".ewin.edit get 1.0 end"))
(tk ".ewin.edit insert end {" (upper-case text) "}")
(tk "update idletasks"))
(context 'MAIN)
(EDIT:edit)
Lutz
Thanks for the start.
I had problems to get it to work.
I think this was a problem with this makro from init.lsp
So I rename the new edit function to "myedit" and it works as expected.
Is it possible that the namespace does not isolate the function against this makro?
I had problems to get it to work.
I think this was a problem with this makro from init.lsp
Code: Select all
(define-macro (edit _func)
(save (string _func) _func)
(! (string "/usr/bin/vi " _func))
(load (string _func)))
Is it possible that the namespace does not isolate the function against this makro?
Hans-Peter
Code: Select all
(context 'EDIT)
(define (edit )
(tk "if {[winfo exists .ewin] == 1} {destroy .ewin}")
(tk "toplevel .ewin")
(tk "text .ewin.edit -width 60 -height 10")
(tk "pack .ewin.edit")
(tk "bind .ewin.edit <Return> {Newlisp {(silent (EDIT:getEditText))}}")
(tk "update idletasks"))
(define (getEditText )
(set 'text (tk ".ewin.edit get 1.0 end"))
(tk ".ewin.edit insert end {" (upper-case text) "}")
(tk "update idletasks"))
(context 'MAIN)
Hans-Peter