: boxed_radio_column { //define boxed radio column
label = "Pick a color";
: row {
: radio_button { //define radio button
label = "White"; //give it a label
key = "rb1"; //give it a name
}
: radio_button {
label = "Green";
key = "rb2";
}
}
: row {
: radio_button { //define radio button
label = "Red"; //give it a label
key = "rb3"; //give it a name
}
: radio_button {
label = "Yellow";
key = "rb4";
}
}
}
// TEST.DCL
// Profiel-insertroutine Copyright (c) '94/'04 J.J.Damstra
// For demonstration only (published on 'the Swamp' on 11-31-'04
dcl_settings : default_dcl_settings { audit_level = 3; }
profiel : dialog {
label = "PROFIEL DEMO";
: row {
: column {
: boxed_row {
label = "Profieltype:";
key = "type";
: radio_column {
: radio_button {
label = "Buis-profielen (CHS)";
key = "buis";
}
spacer_1;
: radio_button {
label = "Damwanden (diverse typen)";
key = "damwand";
}
spacer_1;
: radio_button {
label = "DIE; DIL; DIN; DIR en DIH";
key = "dix";
}
spacer_1;
: radio_button {
label = "Geïntergreerde ligger, type: ASB";
key = "asb";
}
: radio_button {
label = "Geïntergreerde ligger, type: IFB";
key = "ifb";
}
: radio_button {
label = "Geïntergreerde ligger, type: SFB";
key = "sfb";
}
: radio_button {
label = "Geïntergreerde ligger, type: THQ";
key = "thq";
}
spacer_1;
: radio_button {
label = "HEAA-profiel";
key = "heaa";
}
: radio_button {
label = "HEA-profiel";
key = "hea";
}
: radio_button {
label = "HEB-profiel";
key = "heb";
}
: radio_button {
label = "HEC-profiel";
key = "hec";
}
: radio_button {
label = "HEM-profiel";
key = "hem";
}
spacer_1;
: radio_button {
label = "HD-profiel";
key = "hd";
}
: radio_button {
label = "HL-profiel";
key = "hl";
}
spacer_1;
: radio_button {
label = "IPE-profiel";
key = "ipe";
}
: radio_button {
label = "IPE A; IPE O; IPE V en IPE 750";
key = "ipe-a";
}
}
: radio_column {
: radio_button {
label = "INP-profiel";
key = "inp";
}
spacer_1;
: radio_button {
label = "Hoeklijn gelijkzijdig";
key = "hoek1";
}
: radio_button {
label = "Hoeklijn ongelijkzijdig";
key = "hoek2";
}
spacer_1;
: radio_button {
label = "Koker gelijkzijdig (RHS)";
key = "koker1";
}
: radio_button {
label = "Koker ongelijkzijdig (RHS)";
key = "koker2";
}
spacer_1;
: radio_button {
label = "MONTAN-profiel";
key = "montan";
}
spacer_1;
: radio_button {
label = "Platstaal/Strip";
key = "strip";
}
spacer_1;
: radio_button {
label = "Raatligger";
key = "raat";
}
spacer_1;
: radio_button {
label = "Rails";
key = "rails";
}
spacer_1;
: radio_button {
label = "T-staal (1:1)";
key = "T-staal1";
}
: radio_button {
label = "TB-staal (2:1)";
key = "T-staal2";
}
spacer_1;
: radio_button {
label = "UAP-profiel";
key = "uap";
}
: radio_button {
label = "UPE-profiel";
key = "upe";
}
spacer_1;
: radio_button {
label = "UNP-profiel";
key = "unp";
}
spacer_1;
: radio_button {
label = "Z-profiel";
key = "z";
}
}
}
}
}
spacer_1;
ok_cancel_err;
}
(defun c:test (/ profiel)
(setq dcl_id (load_dialog "test.dcl"))
(if (not (new_dialog "profiel" dcl_id)) (exit))
(action_tile "buis" "(wis2)(buis)")
(action_tile "damwand" "(wis2)(damwand)")
(action_tile "dix" "(wis2)(dix)")
(action_tile "heaa" "(wis2)(heaa)")
(action_tile "hea" "(wis2)(hea)")
(action_tile "heb" "(wis2)(heb)")
(action_tile "hec" "(wis2)(hec)")
(action_tile "hem" "(wis2)(hem)")
(action_tile "hd" "(wis2)(hd)")
(action_tile "hl" "(wis2)(hl)")
(action_tile "asb" "(wis2)(asb)")
(action_tile "ifb" "(wis2)(ifb)")
(action_tile "sfb" "(wis2)(sfb)")
(action_tile "thq" "(wis2)(thq)")
(action_tile "ipe" "(wis2)(ipe)")
(action_tile "ipe-a" "(wis2)(ipe-a)")
(action_tile "inp" "(wis1)(inp)")
(action_tile "hoek1" "(wis1)(hoek1)")
(action_tile "hoek2" "(wis1)(hoek2)")
(action_tile "koker1" "(wis1)(koker1)")
(action_tile "koker2" "(wis1)(koker2)")
(action_tile "montan" "(wis1)(montan)")
(action_tile "raat" "(wis1)(raat)")
(action_tile "rails" "(wis1)(rails)")
(action_tile "strip" "(wis1)(strip)")
(action_tile "T-staal1" "(wis1)(t1)")
(action_tile "T-staal2" "(wis1)(t2)")
(action_tile "uap" "(wis1)(uap)")
(action_tile "upe" "(wis1)(upe)")
(action_tile "unp" "(wis1)(unp)")
(action_tile "z" "(wis1)(z-prof)")
(action_tile "accept" "(done_dialog 1)(setq profiel 1")
(action_tile "cancel" "(done_dialog 0)(setq profiel 0)")
(while (not profiel)(start_dialog))
(alert "Your program starts here")
(princ)
)
(defun message (bericht)
(set_tile "error" bericht)
)
(defun asb ()
(message "ASB-geïntergreerde ligger")
)
(defun buis ()
(message "Buisprofielen")
)
(defun damwand ()
(message "Diverse stalen damwandprofielen")
)
(defun dix ()
(message "Antieke profielen")
)
(defun heaa ()
(message "HEAA-profielen")
)
(defun hea ()
(message "HEA-profielen")
)
(defun heb ()
(message "HEB-profielen")
)
(defun hec ()
(message "HEC-profiel")
)
(defun hem ()
(message "HEM-profielen")
)
(defun hl ()
(message "HL-profielen")
)
(defun hd ()
(message "HD-profielen")
)
(defun ipe ()
(message "IPE-profielen")
)
(defun ipe-a ()
(message "IPE A; IPE O; IPE V en IPE 750")
)
(defun ifb ()
(message "IFB-geïntergreerde ligger")
)
(defun inp ()
(message "INP-profielen")
)
(defun hoek1 ()
(message "Gelijkzijdige hoeklijnen")
)
(defun hoek2 ()
(message "Ongelijkzijdige hoeklijnen")
)
(defun koker1 ()
(message "Gelijkzijdige kokerprofielen")
)
(defun koker2 ()
(message "Ongelijkzijdige kokerprofielen")
)
(defun montan ()
(message "MONTAN-profiel")
)
(defun raat ()
(message "Raatliggers")
)
(defun rails ()
(message "Kraanbaanliggers en spoorrails")
)
(defun sfb ()
(message "SFB-geïntergreerde ligger")
)
(defun strip ()
(message "Platstaal en strippen")
)
(defun t1 ()
(message "T-staal (gelijkzijdig)")
)
(defun t2 ()
(message "TB-staal (ongelijkzijdig)")
)
(defun thq ()
(message "THQ-geïntergreerde ligger")
)
(defun uap ()
(message "UAP-profielen")
)
(defun upe ()
(message "UPE-profielen")
)
(defun unp ()
(message "UNP-profielen")
)
(defun z-prof ()
(message "Z-profielen")
)
(defun wis1 ()(set_tile "buis" "2")(set_tile "buis" "0"))
(defun wis2 ()(set_tile "unp" "2")(set_tile "unp" "0"))
(princ)
....
(defun wis1 ()(set_tile "buis" "2")(set_tile "buis" "0"))
(defun wis2 ()(set_tile "unp" "2")(set_tile "unp" "0"))
....
...Both of your responses result in me having 2 radio buttons with value=1 at the same time.
...
: radio_cluster {
:row {
: column {
: radio_button {
label = "R1";
key = "R1";
}
: radio_button {
label = "R2";
key = "R2";
}
: radio_button {
label = "R3";
key = "R3";
}
}
: column {
: radio_button {
label = "R4";
key = "R4";
}
: radio_button {
label = "R5";
key = "R5";
}
: radio_button {
label = "R6";
key = "R6";
}
}
}
}
boxed_column - A column of objects with a frame
boxed_radio_column - A column of radio_buttons with a frame
boxed_radio_row - A row of radio_buttons with a frame
boxed_row - a row with a frame
button - a simple button
cancel_button - default cancel button
cluster - clustered widgets
color_palette_0_9 - default color dialog palette for the first 10 colors
color_palette_1_7 - default color dialog palette for the ACI colors 1-7
color_palette_1_9 - default color dialog palette for the ACI colors 1-9
color_palette_250_255 - default color dialog palette for the ACI colors 250-255
column - a column of widgets
concatenation - concatenation, used for multiple text widgets
default_button - the default button designation
dialog - The window containing the widgets
edit_box - an editbox
edit12_box - an editbox 12 characters wide with a maximum of 148 characters
edit32_box - an editbox 32 characters wide with a maximum of 2048 characters
errtile - a text tile with the key "error"
fcf_ebox - an edit_box 7 char wide typically used in the files dialog
fcf_ebox1 - an edit_box with a limit of 3 chars
fcf_ibut - image_button 3.5 wide X 1.2 high
fcf_ibut1 - image_button 5 wide aspect ratio of 0.66
files_bottomdf - file edit_box columned with ok_cancel and errtile key = "fedit"
files_topdf - specialty cluster for files dialog
help_button - help button key = help
icon_image - image_button 12 wide aspect ratio of 0.66
image - an image tile
image_block - image height of 1 width of 1
image_button - an image tile button
info_button - predefined button key = "info"
list_box - a list box
ok_button - OK button with key = "accept"
ok_cancel - button cluster
ok_cancel_err - button cluster
ok_cancel_help - button cluster
ok_cancel_help_errtile - button cluster
ok_cancel_help_info - button cluster
ok_only - OK button with key = "accept" but is also the cancel button
paragraph a cluster of vertical text
popup_list - a popup list
radio_button - a radio button
radio_cluster - a cluster of radio buttons
radio_column - a column of radio buttons
radio_row - a row of radio buttons
retirement_button - predefined button with a fixed width of 8
row - a row of widgets
slider - a slider mechanism
spacer - a spacer
spacer_0 - a spacer
spacer_1 - a spacer
std_rq_color - standard complete color palette with controls
swatch - a colored image button 3X1.5
text - a label
text_25 - a label 25 chars long
text_part - a label without margins typically used for paragraphs
tile - the widget
toggle - a toggle button
Where did you find that reference to radio_cluster?
dcl_settings : default_dcl_settings {audit_level=3;}
tcluster : dialog { label = "2007 OPA - Mechancical Pipe - SCD 40 STD";
: radio_cluster {
: row {
: column {
: radio_button {
key = "eb0";
label = "1/2 in";
}
: radio_button {
key = "eb1";
label = "3/4 in";
}
: radio_button {
key = "eb2";
label = "1 in";
}
: radio_button {
key = "eb3";
label = "1-1/2 in";
}
}
: column {
: radio_button {
key = "eb11";
label = "10 in";
}
: radio_button {
key = "eb12";
label = "12 in";
}
: radio_button {
key = "eb13";
label = "14 in";
}
: radio_button {
key = "eb14";
label = "16 in";
}
}
}
}
: boxed_row {
: button {
key = "accept";
label = " OKAY ";
is_default = true;
}
: button {
key = "cancel";
label = " Cancel ";
is_default = false;
is_cancel = true;
}
}
}
(defun c:templsp ()
(if (= PL_WEIGHT nil)(setq PL_WEIGHT 0.0))
(if(not (setq dcl_id (load_dialog "testcluster.dcl")))
(progn
(alert "The file could not be loaded.")
(exit)
)
(progn
(if (not (new_dialog "tcluster" dcl_id))
(progn
(alert "The DCL definition could not be found inside the DCL file.")
(exit))
(progn
(action_tile "eb0" "(setq PL_WEIGHT \"1.45\")(setq PL_UTILITY \"Single Hung 1/2 in\")")
(action_tile "eb1" "(setq PL_WEIGHT \"1.79\")(setq PL_UTILITY \"Single Hung 3/4 in\")")
(action_tile "eb2" "(setq PL_WEIGHT \"2.67\")(setq PL_UTILITY \"Single Hung 1 in\")")
(action_tile "eb3" "(setq PL_WEIGHT \"4.24\")(setq PL_UTILITY \"Single Hung 1-1/2 in\")")
(action_tile "eb11" "(setq PL_WEIGHT \"80.95\")(setq PL_UTILITY \"Single Hung 10 in\")")
(action_tile "eb12" "(setq PL_WEIGHT \"105.53\")(setq PL_UTILITY \"Single Hung 12 in\")")
(action_tile "eb13" "(setq PL_WEIGHT \"120.62\")(setq PL_UTILITY \"Single Hung 14 in\")")
(action_tile "eb14" "(setq PL_WEIGHT \"147.54\")(setq PL_UTILITY \"Single Hung 16 in\")")
(action_tile "accept" "(done_dialog 2)")
(action_tile "cancel" "(done_dialog 1)")
(setq ddiag(start_dialog))
(unload_dialog dcl_id)
(if (= ddiag 1)(princ "\n \n ...DCL_LSP Cancelled. \n "))
(if (= ddiag 2)
(progn
(princ "\n You test ")
)
)
)
)
))
(princ))
====== DCL semantic audit of testcluster.dcl ======
Warning in "tcluster". (widget type = cluster, key = "")
Only radio buttons and spacers can be in radio clusters.
Warning in "tcluster". (widget type = radio_button, key = "eb0")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb1")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb2")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb3")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb11")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb12")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb13")
A radio button\'s parent must be a radio cluster.
Warning in "tcluster". (widget type = radio_button, key = "eb14")
A radio button\'s parent must be a radio cluster.
(defun c:tmplsp ()
(if (not (setq dcl_id (load_dialog "testcluster.dcl")))
(progn (alert "The file could not be loaded.") (exit))
(progn
(if (not (new_dialog "tcluster" dcl_id))
(progn
(alert "The DCL definition could not be found inside the DCL file.")
(exit)
)
(progn
(setq col0 '("eb0" "eb1" "eb2" "eb3")
col1 '("eb10" "eb11" "eb12" "eb13")
zer '("0" "0" "0" "0")
)
(defun togcol (button / rtn)
(cond
((member button col1) (mapcar 'set_tile col0 zer))
((member button col0) (mapcar 'set_tile col1 zer))
)
button
)
(action_tile "col0" "(setq choice (togcol (get_tile \"col0\")))")
(action_tile "col1" "(setq choice (togcol (get_tile \"col1\")))")
(action_tile "accept" "(done_dialog 2)")
(action_tile "cancel" "(done_dialog 1)")
(setq ddiag (start_dialog))
(unload_dialog dcl_id)
(if (= ddiag 1) (princ "\n \n ...DCL_LSP Cancelled. \n "))
(if (= ddiag 2)
(cond
((= choice "eb0") (setq PL_WEIGHT "0.56" PL_UTILITY "Single Hung 1/2 in"))
((= choice "eb1") (setq PL_WEIGHT "1.79" PL_UTILITY "Single Hung 3/4 in"))
((= choice "eb2") (setq PL_WEIGHT "2.67" PL_UTILITY "Single Hung 1 in"))
((= choice "eb3") (setq PL_WEIGHT "4.24" PL_UTILITY "Single Hung 1-1/2 in"))
((= choice "eb10") (setq PL_WEIGHT "80.95" PL_UTILITY "Single Hung 10 in"))
((= choice "eb11") (setq PL_WEIGHT "105.53" PL_UTILITY "Single Hung 12 in"))
((= choice "eb12") (setq PL_WEIGHT "120.62" PL_UTILITY "Single Hung 14 in"))
((= choice "eb13") (setq PL_WEIGHT "147.54" PL_UTILITY "Single Hung 16 in"))
)
)
(princ (strcat "\n You Selected: " pl_utility " , Weight: " pl_weight))
)
)
)
)
(princ)
)
tcluster : dialog { label = "2007 OPA - Mechancical Pipe - SCD 40 STD";
: row {
: radio_column {
key = "col0";
: radio_button {key = "eb0"; label = "1/2 in"; }
: radio_button {key = "eb1"; label = "3/4 in"; }
: radio_button {key = "eb2"; label = "1 in"; }
: radio_button {key = "eb3"; label = "1-1/2 in";}
}
: radio_column {
key = "col1";
: radio_button {key = "eb10"; label = "10 in"; }
: radio_button {key = "eb11"; label = "12 in"; }
: radio_button {key = "eb12"; label = "14 in"; }
: radio_button {key = "eb13"; label = "16 in"; }
}
}
:boxed_row {
ok_cancel;
}
}
(defun c:tmplsp (/ choice)
(defun ClearCol1() (mapcar '(lambda(x) (set_tile x "0")) '("eb10""eb11""eb12""eb13")))
(defun ClearCol0() (mapcar '(lambda(x) (set_tile x "0")) '("eb0""eb1""eb2""eb3")))
(if (not (setq dcl_id (load_dialog "testcluster.dcl")))
(progn (alert "The file could not be loaded.") (exit))
(progn
(if (not (new_dialog "tcluster" dcl_id))
(alert "The DCL definition could not be found inside the DCL file.")
(progn
(action_tile "col0" "(setq choice $value)(clearCol1)")
(action_tile "col1" "(setq choice $value)(clearCol0)")
(action_tile "accept" "(done_dialog 2)")
(action_tile "cancel" "(done_dialog 1)")
(setq ddiag (start_dialog))
(unload_dialog dcl_id)
(cond
((= ddiag 1) (princ "\n \n ...DCL_LSP Cancelled. \n "))
((/= ddiag 2)(princ "\n \n ...DCL_LSP Cancelled. \n "))
((= choice "eb0") (setq PL_WEIGHT "0.56" PL_UTILITY "Single Hung 1/2 in"))
((= choice "eb1") (setq PL_WEIGHT "1.79" PL_UTILITY "Single Hung 3/4 in"))
((= choice "eb2") (setq PL_WEIGHT "2.67" PL_UTILITY "Single Hung 1 in"))
((= choice "eb3") (setq PL_WEIGHT "4.24" PL_UTILITY "Single Hung 1-1/2 in"))
((= choice "eb10") (setq PL_WEIGHT "80.95" PL_UTILITY "Single Hung 10 in"))
((= choice "eb11") (setq PL_WEIGHT "105.53" PL_UTILITY "Single Hung 12 in"))
((= choice "eb12") (setq PL_WEIGHT "120.62" PL_UTILITY "Single Hung 14 in"))
((= choice "eb13") (setq PL_WEIGHT "147.54" PL_UTILITY "Single Hung 16 in"))
)
(if choice (princ (strcat "\n You Selected: " pl_utility " , Weight: " pl_weight)))
)
)
)
)
(princ)
)
tcluster : dialog { label = "2007 OPA - Mechancical Pipe - SCD 40 STD";
: row {
: radio_column { key = "col0";
: radio_button {key = "eb0"; label = "1/2 in"; }
: radio_button {key = "eb1"; label = "3/4 in"; }
: radio_button {key = "eb2"; label = "1 in"; }
: radio_button {key = "eb3"; label = "1-1/2 in";}
}
: radio_column { key = "col1";
: radio_button {key = "eb10"; label = "10 in"; }
: radio_button {key = "eb11"; label = "12 in"; }
: radio_button {key = "eb12"; label = "14 in"; }
: radio_button {key = "eb13"; label = "16 in"; }
}
}
:boxed_row {
ok_cancel;
}
}
(defun clrbut (choice)
(setq cluster '("eb0" "eb1" "eb2" "eb3" "eb10" "eb11" "eb12" "eb13"))
(mapcar '(lambda(x) (set_tile x "0")) cluster)
(set_tile choice "1")
)
(action_tile "col0" "(clrbut (setq choice $value))")
(action_tile "col1" "(clrbut (setq choice $value))")
(defun clrbut (col / but cluster)
(setq cluster '("col0" "col1"))
(foreach cl (vl-remove col cluster)
(if (setq but (get_tile cl))(set_tile but "0"))
)
)
(action_tile "col0" "(setq choice $value)(clrbut \"col0\")")
(action_tile "col1" "(setq choice $value)(clrbut \"col1\")")
tcluster : dialog { label = "2007 OPA - Mechancical Pipe - SCD 40 STD";
: row {
: radio_column { key= "col0";
: radio_button {key = "eb0"; label = "1/2 in"; }
: radio_button {key = "eb1"; label = "3/4 in"; }
: radio_button {key = "eb2"; label = "1 in"; }
: radio_button {key = "eb3"; label = "1-1/2 in";}
}
: radio_column { key= "col1";
: radio_button {key = "eb10"; label = "10 in"; }
: radio_button {key = "eb11"; label = "12 in"; }
: radio_button {key = "eb12"; label = "14 in"; }
: radio_button {key = "eb13"; label = "16 in"; }
}
}
:boxed_row { ok_cancel; }
}
(defun clrbut (k / b)
(mapcar '(lambda(x) (if (setq b (get_tile x ))(set_tile b "0"))) (vl-remove k '("col0" "col1")))
)
(action_tile "col0" "(setq choice $value)(clrbut $key)")
(action_tile "col1" "(setq choice $value)(clrbut $key)")
Yet another one for the clearing function...
(foreach x '("col0" "col1")
(action_tile x "(if (/= $value choice) (set_tile choice \"0\")) (setq choice $value)")
)
(action_tile x "(if choice (set_tile choice \"0\")) (setq choice $value)"))
In this case, the button will be deselected if you click twice on it.
Maybe:Code: [Select](action_tile x "(if choice (set_tile choice \"0\")) (setq choice $value)"))
Little clearer and concise.
ymg
Or this, without clrbutCode - Auto/Visual Lisp: [Select]
(setq choice $value)") )
Here's the final take hopefully!
Don't much like doing the processing with the dialog ON, so I prefer (exit).
I would get rid of the progn and move the printing of results outside.
hmspe,
Could not run your routine as block "fault-CUAL.dwg" is missing.
ymg
Nicely done Stefan :-)Thank you Lee
Not really. This code is around 10 years old. I think I've gotten a bit better at coding since then. That said, I'm an engineer that occasionally writes code to automate my work, and trying to remember how elegant/compact/fast constructs work when you don't write code regularly is a challenge. I'm more concerned with being able to maintain my code in the future. Simple structure may not be as efficient but it is easy to maintain. In this case the speed of simple code is more than adequate. At a previous job where I wrote code for testing jet engines for use with 6MHz PC AT computers efficiency came first. With a 3GHZ+ computer and writing for internal use only I'm only worried about "fast enough".
Looks like you like to type :-)