(defun C:LAS ( / N_ActionAccept N_ActionCancel N_ActionSleutel N_UpdateDialog dcl_id layoutLst selectedLayout)

(defun N_ActionAccept ()
(if (and layoutLst (/= (get_tile "lays") ""))
(setq selectedLayout (nth (atoi (get_tile "lays")) layoutLst))
)
(done_dialog)
)

(defun N_ActionCancel ()
(done_dialog)
)

(defun N_ActionSleutel ( / match)
(setq layoutLst (cons "Model" (layoutlist)))
(if (/= (setq match (strcase (get_tile "sleutel"))) "")
(setq layoutLst (vl-remove-if-not '(lambda (a) (wcmatch (strcase a) match)) layoutLst))
)
(N_UpdateDialog)
)

(defun N_UpdateDialog ()
(start_list "lays")
(mapcar 'add_list layoutLst)
(end_list)
)

(setq dcl_id (load_dialog "LAYOUTS.dcl"))
(if (not (new_dialog "LAYOUTS" dcl_id))
(progn
(alert "The LAYOUTS.DCL file could not be loaded!")
(exit)
)
)
(setq layoutLst (cons "Model" (layoutlist)))
(N_UpdateDialog)
(action_tile "sleutel" "(N_ActionSleutel)")
(action_tile "accept" "(N_ActionAccept)")
(action_tile "cancel" "(N_ActionCancel)")
(start_dialog)
(unload_dialog dcl_id)
(if selectedLayout
(progn
(setvar 'ctab selectedLayout)
(princ (strcat "\nCurrent Layout: " selectedLayout))
)
(princ "\nCurrent Layout NOT changed ")
)
(princ)
)
(c:las)

****** LAYOUTS.dcl ********

LAYOUTS : dialog {
label = "Select Layout to make Current";
: column {
: row {
: boxed_column {
: edit_box {
key = "sleutel";
label = "Search";
mnemonic = "Z";
}
: button {
key = "toepassen";
label = " Apply ";
}
: list_box {
key = "lays";
label = "Layouts:";
multiple_select = false;
allow_accept = true;
width = 40;
}
}
}
: row {
: boxed_row {
: button {
key = "accept";
label = " Ok ";
is_default = true;
}
: button {
key = "cancel";
label = " Cancel ";
is_default = false;
is_cancel = true;
}
}
}
}
}

Advertisements