尝试将此代码改写为您的西装:
- (defun C:NUMP (/ dcl_id text pick)
-
- (defun box_callback(text act)
- (if (member act (list 1 2))
- (if (not (wcmatch text "###.#.##" ))
- (progn
- (set_tile "txt" (substr text 1 (1- (strlen text))))
- (alert "Wrong character removed, try again")
- )
- )
- )
- )
- (defun rem_blanks (input)
- (vl-list->string
- (vl-remove 32
- (vl-string->list input)
- )
- )
- )
-
- (setvar "CMDECHO" 0)
- (setq dcl_id (load_dialog "NUMP.dcl"))
- (if (not (new_dialog "NUMP" dcl_id))
- (exit))
- (action_tile
- "txt"
- "(box_callback $value $reason)"
- )
- (action_tile "accept" (strcat
- "(progn "
- "(setq text (get_tile "txt"))"
- "(done_dialog 1))"))
- (action_tile
- "cancel"
- "(done_dialog 2)")
- (setq pick (start_dialog))
- (unload_dialog dcl_id)
- (if (= pick 1)
- (alert (strcat "You entered: " (rem_blanks text))))
- (setvar "CMDECHO" 1)
- (princ)
- )
//DCL
- NUMP : dialog {
- label = "Validate Text Input";
- spacer;
- :row {
- fixed_width = true;
- : boxed_column {
- label = " Enter numbers in format of XXX.X.XX:";
- fixed_width = true;
- width=30;
- : edit_box {
- key = "txt";
- initial_focus=true;
- edit_width =29;
- fixed_width_font =true;
- }
- spacer;
- }
- }
- ok_cancel;
- }
|