The following function displays an Input Box
similar to the VBA Input Box
function.
Syntax : (inputbox "prompt"
"title" "default")
e.g. (inputbox "Enter Number"
"AfraLisp Inputbox" "342.34")
Returns a variable "inputvalue"
containing the value of the
Edit Box.
DCL Coding :
//CODING STARTS HERE
inputbox : dialog {
key = "title";
: text {
key = "prompt";
}
: edit_box {
key = "eb1";
}
ok_cancel;
}
//CODING ENDS HERE
--------------------------------------------
Save this as "Inputbox.dcl"
Now the Coding :
;CODING STARTS HERE
(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)
;CODING ENDS HERE
Save as "Inputbox.lsp"
|