RepCad Posted April 11, 2021 Posted April 11, 2021 Hi all, I'm trying to design a dcl for my prgram, but I have a problem with alignment of radio buttons, as you see the right radio buttons are not aligned, is there a way to arrange them like this? dclnam : dialog { key = "Title"; label = " Parcel "; initial_focus = "Edit1"; spacer; width = 35; : boxed_radio_column { label = " Test1 "; : row { : radio_button { label = " Polyline "; key = "tpol"; value = " 1 "; } : radio_button { label = " Mtext "; key = "tmtex"; }} } : boxed_radio_column { label = " Test2 "; : row { : radio_button { label = " Color "; key = "ttep"; value = " 1 "; } : radio_button { label = " LineWeight "; key = "ttem"; }} } : boxed_radio_column { label = " Closed Polyline "; : row { : radio_button { label = " in "; key = "tiin"; value = " 1 "; } : radio_button { label = " out "; key = "tiout"; }} } Quote
rlx Posted April 11, 2021 Posted April 11, 2021 parcel : dialog {key="Title";label=" Parcel"; spacer; :boxed_radio_row {children_fixed_width=true; label=" Test1 "; :radio_button {width=16;label=" Polyline ";key="tpol";value="1";} :radio_button {width=16;label=" Mtext ";key="tmtex";}} :boxed_radio_row {children_fixed_width=true;label=" Test2 "; :radio_button {width=16;label=" Color ";key = "ttep";value = "1";} :radio_button {width=16;label=" LineWeight ";key = "ttem";}} :boxed_radio_row {children_fixed_width=true;label=" Closed Polyline "; :radio_button {width=16;label=" in ";key="tiin";value="1";} :radio_button {width=16;label= " Out ";key="tiout";}} :boxed_radio_row {children_fixed_width=true;label=" UnClosed Polyline "; :radio_button {width=16;label=" Up ";key="tiup";value="1";} :radio_button {width=16;label= " Bottom ";key="tibottom";}} spacer;spacer; :column {:row {fixed_width=true;alignment=centered; :button {key="bt_save";label="Save";} :button {is_default=true;key="bt_exit";label="Exit";}}} } 1 Quote
Lee Mac Posted April 11, 2021 Posted April 11, 2021 The key is to define the radio_button tiles to each have the same fixed width, large enough to accommodate the largest of your labels; for this, I would suggest defining a custom radio_button tile which may then be used through the remainder of the dialog definition, e.g.: rb : radio_button { width = 18; fixed_width = true; } test : dialog { spacer; : boxed_column { label = "Test 1"; : radio_row { : rb { key = "tpol"; label = "Polyline"; } : rb { key = "tmtx"; label = "MText"; } } spacer; } : boxed_column { label = "Test 2"; : radio_row { : rb { key = "ttep"; label = "Colour"; } : rb { key = "ttem"; label = "Lineweight"; } } spacer; } ok_cancel; } 1 Quote
rlx Posted April 11, 2021 Posted April 11, 2021 that works too Lee, more than one road lead to Rome 1 Quote
BIGAL Posted April 11, 2021 Posted April 11, 2021 Learn something new everyday did not know you could define like a defun in a dcl. Save a lot of lines in coding. This is a variation I am working on it would support multiple like the dcl required. It does vertical now but could add horizontal with the great suggestion from Lee. Its next version of Multi radio buttons.lsp. You just have multiple lists and it will auto create the columns required. (if (not ah:buttscol)(load "Multi Radio buttons 2col.lsp")) (if (= ah:but nil)(setq ah:but 1)) (if (= ah:but2 nil)(setq ah:but2 1)) (setq lst (list "Select angle" "2 pts" "45" "90" "180" "225" "270" "315" )) (setq lst2 (list "Select type" "Rotate" "Label" "Marker" "Both")) (ah:buttscol ah:but ah:but2 "Rotate point" '(lst lst2)) Now to rewrite it all again. Quote
rlx Posted April 12, 2021 Posted April 12, 2021 yeah , I knew about the 'dcl defun' and in this case it works perfect but if you have multiple dialogs you may need multiple defuns like rb_18 & rb_24 Quote
RepCad Posted April 12, 2021 Author Posted April 12, 2021 (edited) On 4/11/2021 at 3:01 PM, rlx said: parcel : dialog {key="Title";label=" Parcel"; spacer; :boxed_radio_row {children_fixed_width=true; label=" Test1 "; :radio_button {width=16;label=" Polyline ";key="tpol";value="1";} :radio_button {width=16;label=" Mtext ";key="tmtex";}} :boxed_radio_row {children_fixed_width=true;label=" Test2 "; :radio_button {width=16;label=" Color ";key = "ttep";value = "1";} :radio_button {width=16;label=" LineWeight ";key = "ttem";}} :boxed_radio_row {children_fixed_width=true;label=" Closed Polyline "; :radio_button {width=16;label=" in ";key="tiin";value="1";} :radio_button {width=16;label= " Out ";key="tiout";}} :boxed_radio_row {children_fixed_width=true;label=" UnClosed Polyline "; :radio_button {width=16;label=" Up ";key="tiup";value="1";} :radio_button {width=16;label= " Bottom ";key="tibottom";}} spacer;spacer; :column {:row {fixed_width=true;alignment=centered; :button {key="bt_save";label="Save";} :button {is_default=true;key="bt_exit";label="Exit";}}} } Thank you man, if I want to add another column of text box, shall I add column or row? (white boxes are edit text type) Edited April 12, 2021 by amir0914 Quote
rlx Posted April 12, 2021 Posted April 12, 2021 also making use of 'dcl defun' suggested by master Lee to make the code more compact : rb : radio_button {fixed_width=true;width=18;} eb : edit_box {fixed_width=true;width=18;} parcel : dialog {label=" Parcel with columns"; spacer; : row { : column {children_fixed_height=true; :boxed_radio_row {label="Test1"; :rb {label="Polyline";key="tpol";value="1";} :rb {label="Mtext";key="tmtex";}} :boxed_radio_row {label="Test2"; :rb {label="Color";key="ttep";value = "1";} :rb {label="LineWeight";key="ttem";}} :boxed_radio_row {label="Closed Polyline"; :rb {label="In";key="tiin";value="1";} :rb {label="Out";key="tiout";}} :boxed_radio_row {label="UnClosed Polyline"; :rb {label="Up";key="tiup";value="1";} :rb {label="Bottom";key="tibottom";}} } : column {children_fixed_height=true; :boxed_row {label="Value 1";:eb {key="eb_val1";}} :boxed_row {label="Value 2";:eb {key="eb_val2";}} :boxed_row {label="Value 3";:eb {key="eb_val3";}} spacer;spacer;spacer; } } spacer; :column {:row {fixed_width=true;alignment=centered; :button {key="bt_save";label="Save";}:button {is_default=true;key="bt_exit";label="Exit";}}} } parcel2 : dialog {label="Parcel with rows";spacer; : row {:column {label="Test1";:radio_row {:rb {label="Polyline";key="tpol";value="1";} :rb {label="Mtext";key="tmtex";}}} :eb {label="Value 1";key="eb_val1";}} : row {:column {label="Test2";:radio_row {:rb {label="Color";key="ttep";value = "1";} :rb {label="LineWeight";key="ttem";}}} :eb {label="value 2";key="eb_val2";}} : row {:column {label="Test3";:radio_row {:rb {label="In";key="tiin";value="1";} :rb {label="Out";key="tiout";}}} :eb {label="value 3";key="eb_val3";}} : row {:column {label="UnClosed Polyline";:radio_row {:rb {label="Up";key="tiup";value="1";} :rb {label="Bottom";key="tibottom";}}}spacer;:row {width=18;}} spacer; :column {:row {fixed_width=true;alignment=centered; :button {key="bt_save";label="Save";}:button {is_default=true;key="bt_exit";label="Exit";}}} } 1 Quote
RepCad Posted April 15, 2021 Author Posted April 15, 2021 (edited) Thanks for your sincerely help. Edited April 15, 2021 by amir0914 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.