The AutoLISP Input Box
This routine is very similar to the Visual Basic Input Box Function. To use this routine you feed the function 3 arguments, the Input Box Prompt, the Title of the Input Box, and the Default Value of the Edit Box.
The syntax is straightforward:
(inputbox "prompt" "title" "default")
For example, the Input Box above was called by using the following command:
(inputbox "Enter Number" "AfraLisp Inputbox" "342.34")
The Input Box returns a variable "inputvalue" containing the value of the Edit Box.
Source Coding
First the DCL Coding :
inputbox : dialog { key = "title"; : text { key = "prompt"; } : edit_box { key = "eb1"; } ok_cancel; }
And next the AutoLisp Coding :
(defun inputbox (prompt title default)
(setq dcl_id (load_dialog "inputbox.dcl"))
(if (not (new_dialog "inputbox" dcl_id))
(exit)
)
(set_tile "prompt" prompt)
(set_tile "title" title)
(set_tile "eb1" default)
(mode_tile "eb1" 2)
(action_tile
"cancel"
"(done_dialog)
(setq result nil)"
)
(action_tile
"accept"
"(setq inputvalue (get_tile \"eb1\"))
(done_dialog)
(setq result T)"
)
(start_dialog)
(unload_dialog dcl_id)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(princ)
If you would like the source coding for the the Input Box routine, just place your mouse here and click… Enjoy.