jmerch Posted December 13, 2010 Share Posted December 13, 2010 I've searched what I could and can't find my answer. Is there a LISP function similar to "alert" but instead of just the pop-up box it let's the user input something there (instead of using "prompt" in LISP)? Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 13, 2010 Share Posted December 13, 2010 Roll your own with DCL/ODCL or check out DosLib, it has a few input 'alert' style boxes. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 13, 2010 Share Posted December 13, 2010 Thought it'd be fun to write an example: (defun PromptBox ( title msg / dcl dch file val ) ;; ------------------------------------------- ;; ;; Arguments:- ;; ;; ------------------------------------------- ;; ;; title - Dialog Box Title ;; ;; msg - [Optional] Text to Display ;; ;; ------------------------------------------- ;; ;; Returns:- ;; ;; ------------------------------------------- ;; ;; Entered String if user presses OK, else nil ;; ;; ------------------------------------------- ;; ;; Example by Lee Mac 2010 - www.lee-mac.com ;; ;; ------------------------------------------- ;; (cond ( (not (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq file (open dcl "w")) (progn (write-line (strcat "promptbox : dialog { label = \"" title "\"; initial_focus = \"txt\"; spacer;" ": edit_box { key = \"txt\"; edit_width = 60; edit_limit = 2048; allow_accept = true; } spacer; ok_cancel; }" ) file ) (setq file (close file)) (findfile dcl) ) ) ) ) ( (<= (setq dch (load_dialog dcl)) 0) (vl-file-delete dcl) ) ( (not (new_dialog "promptbox" dch)) (unload_dialog dch) (vl-file-delete dcl) ) (t (if msg (setq val (set_tile "txt" msg))) (action_tile "txt" "(setq val $value)") (if (zerop (start_dialog)) (setq val nil)) (unload_dialog dch) (vl-file-delete dcl) ) ) val ) 1 Quote Link to comment Share on other sites More sharing options...
jmerch Posted December 13, 2010 Author Share Posted December 13, 2010 @alanjt - Gotcha, will give that a try. Thanx. @lee - I can understand most of that but will disect it later. It looks like you're having LISP write the DCL which I think is very funny and cool. I did take a gander at AfraLISP's DCL beginner guide and may have what I need to get me going. But am still intrigued at your direction with this. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 13, 2010 Share Posted December 13, 2010 @lee - I can understand most of that but will disect it later. It looks like you're having LISP write the DCL which I think is very funny and cool. I did take a gander at AfraLISP's DCL beginner guide and may have what I need to get me going. But am still intrigued at your direction with this. Yes, the DCL file is written to a temporary filename generated by vl-filename-mktemp, this file is then deleted following function completion. You can test it with something like: (PromptBox "Information" "AutoLISP is Fun") Or maybe: (PromptBox "Title" nil) Lee 1 Quote Link to comment Share on other sites More sharing options...
jmerch Posted December 13, 2010 Author Share Posted December 13, 2010 Ok, will give those a try. Thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 13, 2010 Share Posted December 13, 2010 Ok, will give those a try. Thanks! You're very welcome JMerch - any questions about the code, just ask Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.