DCL Edit Boxes Alignment Question

DCL Edit Boxes Alignment Question

arshdeepsingh404
Advocate Advocate
737 Views
4 Replies
Message 1 of 5

DCL Edit Boxes Alignment Question

arshdeepsingh404
Advocate
Advocate

Hello Everyone,

 

I have a question reading the best practices for aligning an Edit Box inside of Boxed Column. By default it seems like the Edit Box Label is displayed left aligned to the dialog box and the actual edit box is displayed as right aligned to the dialog box.

I can add more spacing to right side by using a few spacer; but I was wondering if there is a better way to do this instead of adding 10 spacers.

 

Current Code Preview:

arshdeepsingh404_0-1737995008664.png

 

This is what I want the dialog to look like.

arshdeepsingh404_1-1737995034966.png

 

 

 

Sample_Dialog : dialog

{ label = "Sample Dialog";

  : boxed_column {
    label = "Boxed column title" ;

    : column { 
      : radio_button {key = "OptionA"; label = "Option A - This is a sample option text for a radio button"; value = 1; alignment = left; fixed_width = true; width = 5;}
      : radio_button {key = "OptionB"; label = "Option B - This is a sample option text for a radio button"; value = 0; alignment = left; fixed_width = true; width = 5;}
    }

    : row {
      : edit_box {label = "Edit box 1"; key = "EditBox1"; alignment = left; edit_limit = 10; edit_width = 10; value = 1;}
    }

    : row {
      : edit_box {label = "Edit box 2"; key = "EditBox2"; alignment = left; edit_limit = 10; edit_width = 10; value = 1;}
    }
  }

  ok_cancel;

}

 

 

Regards,

Arshdeep Singh, C.Tech, CMSE®
Electrical Designer & Programmer

Please mark as [Accept Solution] if this resolved your issue. It might help someone else with the same question. Likes are welcome!
0 Likes
Accepted solutions (2)
738 Views
4 Replies
Replies (4)
Message 2 of 5

komondormrex
Mentor
Mentor
Accepted solution

check the following

Sample_Dialog : dialog

{ label = "Sample Dialog";

  : boxed_column {
    label = "Boxed column title" ;

    : column { 
      : radio_button {key = "OptionA"; label = "Option A - This is a sample option text for a radio button"; value = 1; alignment = left; fixed_width = true; width = 5;}
      : radio_button {key = "OptionB"; label = "Option B - This is a sample option text for a radio button"; value = 0; alignment = left; fixed_width = true; width = 5;}
    }

    : row {width = 20; fixed_width = true;
      : edit_box {label = "Edit box 1"; key = "EditBox1"; alignment = left; edit_limit = 10; edit_width = 10; value = 1;}
    }

    : row {width = 20; fixed_width = true;
      : edit_box {label = "Edit box 2"; key = "EditBox2"; alignment = left; edit_limit = 10; edit_width = 10; value = 1;}
    }
  }
  ok_cancel;
}
0 Likes
Message 3 of 5

arshdeepsingh404
Advocate
Advocate

This is awesome Komondor. I never thought of just simply reducing the row width inside the dialog.

Thanks a lot!

Regards,

Arshdeep Singh, C.Tech, CMSE®
Electrical Designer & Programmer

Please mark as [Accept Solution] if this resolved your issue. It might help someone else with the same question. Likes are welcome!
0 Likes
Message 4 of 5

scot-65
Advisor
Advisor
Accepted solution

@arshdeepsingh404 

 

Another method I use which will allow flexibility in the spacing is to create a

row with fixed_width=true;

text_part with a defined width; and

edit_box with an assigned edit width.

 

The row's fixed width attribute will compress the line.

Use the tiles width within the row container to set the overall width of the row container.

 

Using text_part will not add buffering space to the end of the string (I never use the text tile).

Be careful here as the text_part will truncate the text if the string is too long - especially if your screen is set to high resolution and the next workstation has the resolution set to a lower setting.

 

By default, justification will always be Left unless specified otherwise.

 

Now to create constants which will reduce total character count within the code:

rfwt :row {fixed_width=true;}

txp12 :text_part {width=12.0;}

ebx10 :edit_box {edit_width=10; edit_limit=10;}

Place these items above the "Dialog" statement in the DCL file.

 

The 2 lines will now be:

:rfwt {:tx12 {key="Tx01";} :ebx10 {key="Edi01";}}

:rfwt {:tx12 {key="Tx02";} :ebx10 {key="Edi02";}}

 

 

Use the LISP set_tile section (in between new_dialog and start_dialog) to populate the text part and edit box value.

(set_tile "Tx01" "Edit box 1")

(set_tile "Edi01" "1")

 

It is best to not assign values inside the dialog part of the code. When you build more comprehensive dialogs you will understand why.

 

Other constants I frequently use include:

rfwtac

swh0;

swh1;

but12

 

I'll let you guess what these are.

 

...and ween yourself of the built-in ok_cancel constant. It has "is_default" built in that may not be desirable in some situations (use mode_tile = 2). (unverified for the latest AutoCAD DCL file)

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 5 of 5

arshdeepsingh404
Advocate
Advocate

Thanks for another great suggestion @scot-65This helps a lot!

Regards,

Arshdeep Singh, C.Tech, CMSE®
Electrical Designer & Programmer

Please mark as [Accept Solution] if this resolved your issue. It might help someone else with the same question. Likes are welcome!
0 Likes