200902210754list_box


list_box.

Syntax:  

    : list_box {
          action alignment allow_accept fixed_height
          fixed_width height is_enabled is_tab_stop
          key label list mnemonic multiple_select
          tabs value width
        }

--------------------------------------------------------------------------------
DCL Coding:  

listbox : dialog {                          //dialog name-->listbox
          label = "list_box" ;            //give it a label-->list_box
         : list_box {                          //define [ list box ]
          key = "selections";            //give it a name --> "selections"
        }                                              //end list

        ok_cancel ;                          //predefined OK/Cancel button

        }                                             //end dialog ---> listbox

--------------------------------------------------------------------------------
AutoLisp Coding:  

(defun C:list_box ()                             ; define function    

  ;  define list ---> M-SIZE
  (setq M-SIZE '("M1" "M3" "M5" "M6"
                 "M8" "M10" "M12")
  );setq

  (setq dcl_id (load_dialog "list_box.dcl"))     ; load dialog

  (if (not (new_dialog "listbox" dcl_id)         ;test for dialog
      )    ; not
    (exit) ; 找不到 listbox 對話框則退出程式
  );if

  (start_list "selections")                      ;start the list box

  (mapcar 'add_list M-SIZE)                      ;fill the list box

  (end_list)                                     ;end list

  (action_tile
    "accept"    ;if O.K. pressed
    (strcat     ;string 'em together
      "(progn
         (setq MSIZE (get_tile \"selections\"))"
         ;get list selection
      "(done_dialog) (setq userclick T))"    
         ;close dialog
    )    ;strcat
  )      ;action tile

  (action_tile
    "cancel"                              ;if cancel button pressed
    "(done_dialog) (setq userclick nil)"  ;close dialog
  )                                       ;action_tile

  (start_dialog)           ;start dialog
  (unload_dialog dcl_id)   ;unload    

  (if userclick                                         ;check O.K. was selected
    (progn                                              ;if it was do the following
      (setq MSIZE (atoi MSIZE))                         ;convert to integer
      (setq MSIZE (nth MSIZE M-SIZE))                   ;get the MSIZE
      (alert (strcat "您所選的 螺紋規格 : " MSIZE))     ;display the MSIZE
    )                                                   ;progn
  )                                                     ;if userclick


 (princ)

);defun

(princ)

回應





Powered by Xuite
    沒有新回應!
關鍵字