Jump to content

Recommended Posts

Posted

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";
			 }}    
	          }

 

Screenshot (2109) - Copy.png

Posted

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";}}}
}

  • Like 1
Posted

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;
}

 

  • Like 1
Posted

that works too Lee, more than one road lead to Rome 🙂

  • Like 1
Posted

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.

 

image.png.f50d06239e1bcc926f262a395c4209c9.png

 

(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.

 

 

 

Posted

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

Posted (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)

 

Screenshot (2109) - Copy.png

Edited by amir0914
Posted

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";}}}
}

 

Parcel1.jpg

Parcel2.jpg

  • Like 1
Posted (edited)

Thanks for your sincerely help.

Edited by amir0914

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...