I'm trying to adjust the sizes and locations of the tiles in this DCL dialog box. Basically, I want to make the edit-box
es in the Client box, Job box, and Miscellaneous box to be the same width. However, they each start at different widths due to the different sizes of the text
tile's labels. Just setting the width to a fixed value for both edit-box
and text
tiles doesn't seem to be fixing the issue for me. How do I need to change this code to make the tiles within this dialog box uniform?
As a bonus, I want to also adjust the tiles in the Revision box. I'm assuming this will be using the same solution. I want to have the widths of the edit-box
es of different widths with the labels centered above them.
I have found that DCL files are a slow and painful process for me. Any help with building this dialog box would be helpful. Thank you for your time.
AutoLisp Code:
(defun C:Test01 (/ sPathAndName sDCLModuleName dclFile bContinue)
;; Initializing
(setq sPathAndName "[File's location and name]")
(setq sDCLModuleName "TitleRevUpdate")
(setq bContinue T)
;; File Exists
(if (not (findfile sPathAndName))(progn
(princ "\nError: The DCL file was not found.\n")
(setq bContinue nil)
));if<-progn
;; DCL File
(if bContinue (progn
(setq dclFile (load_dialog sPathAndName))
(if (>= 0 dclFile)(progn
(princ "\nError: DCL file cannot be loaded.\n")
(setq bContinue nil)
));if<-progn
));if<-progn
;; Creating a new module
(if bContinue
(setq bContinue (new_dialog sDCLModuleName dclFile "" '(-1 -1)))
);if
;; Build and run DCL module
(if bContinue (progn
;; User Form
(princ "\nstart_dialog : ")(princ (start_dialog))(terpri)
(unload_dialog dclFile)
));if<-progn
);C:Test01
DCL Code:
TitleRevUpdate : dialog {
key = "Title" ;
label = "Update Title Block and Revision" ;
// Title
: boxed_column {
key = "Column_TitleBoxes" ;
label = "Title" ;
// Client
: boxed_column {
key = "Client_Box" ;
label = "Client" ;
: row { // Row 01 - Name
key = "Row_Client_Name" ;
width = 15 ;
: text {
key = "txt_Client_Name" ;
alignment = right ;
label = "Client's Name" ;
width = 10 ;
}// text
: edit_box {
key = "edbx_Client_Name" ;
alignment = left ;
width = 10 ;
}// edit_box
} //row
: row { // Row 02 - Location
key = "Row_Client_Loc" ;
: text {
key = "txt_Client_Loc" ;
alignment = right ;
label = "Client's Location" ;
width = 10 ;
}// text
: edit_box {
key = "edbx_Client_Loc" ;
alignment = left ;
width = 10 ;
}// edit_box
} //row
} //boxed_column
: spacer {
}// spacer
// Job
: boxed_column {
key = "Job_Box" ;
label = "Job" ;
: row { // Row 03 - Name
key = "Row_Job_Name" ;
: text {
key = "txt_Job_Name" ;
label = "Job's Name" ;
}// text
: edit_box {
key = "edbx_Job_Name" ;
}// edit_box
} //row
: row { // Row 04 - Number
key = "Row_Job_Number" ;
: text {
key = "txt_Job_Number" ;
label = "Job's Number" ;
}// text
: edit_box {
key = "edbx_Job_Number" ;
}// edit_box
} //row
} //boxed_column
: spacer {
}// spacer
// Miscellaneous
: boxed_column {
key = "Miscellaneous_Box" ;
label = "Miscellaneous" ;
: row { // Row 05 - Creator's Initials
key = "Row_Creator_Name" ;
: text {
key = "txt_Creator_Name" ;
label = "Creator's Name" ;
}// text
: edit_box {
key = "edbx_Creator_Name" ;
}// edit_box
} //row
: row { // Row 06 - Date of Creation
key = "Row_Date" ;
: text {
key = "txt_TitleDate" ;
label = "Date" ;
}// text
: edit_box {
key = "edbx_TitleDate" ;
}// edit_box
} //row
: row { // Row 07 - Issued For
key = "Row_Issued_For" ;
: text {
key = "txt_Issued_For" ;
label = "Issued For" ;
}// text
: edit_box {
key = "edbx_Issued_For" ;
}// edit_box
} //row
} //boxed_column
} //boxed_column
: spacer {
}// spacer
// Revision
: boxed_column {
key = "Column_Revision" ;
label = "Revision" ;
: row { // Row 08 - Quick Choices
key = "Row_Buttons" ;
: button {
key = "btn_IFC" ;
label = "Issued for Construction" ;
}// button
: button {
key = "tbn_AB" ;
label = "As Built" ;
}// button
: radio_column {
key = "RadioCol_WriteMethod" ;
: radio_button {
key = "rbtn_Owt" ;
label = "Clear && Overwrite" ;
}// radio_button
: radio_button {
key = "rbtn_Apnd" ;
label = "Append / New Line" ;
}// radio_button
} //radio_column
} //row
: spacer {
}// spacer
: row { // Row 09 - Rev Labels
key = "Row_Labels" ;
: text {
key = "txt_Rev" ;
label = "Rev" ;
}// text
: text {
key = "txt_Initials" ;
label = "Initials" ;
}// text
: text {
key = "txt_Description" ;
label = "Description" ;
}// text
: text {
key = "txt_RevDate" ;
label = "Date" ;
}// text
} //row
: row { // Row 10 - Rev Edit Boxes
key = "Row_Rev" ;
: edit_box {
key = "edbx_Rev" ;
}// edit_box
: edit_box {
key = "edbx_Initials" ;
}// edit_box
: edit_box {
key = "edbx_Date" ;
}// edit_box
: edit_box {
key = "edbx_RevDate" ;
}// edit_box
} //row
} //boxed_column
: spacer {
}// spacer
// Return Commands
: row { // Row 11 - Buttons
key = "Row_Return" ;
: button {
key = "btn_DWGs" ;
action = "(done_dialog 2)" ;
label = "Show Drawings" ;
}// button
: button {
key = "btn_Confirm" ;
action = "(done_dialog 1)" ;
is_enabled = true ;
label = "Confirm" ;
}// button
: button {
key = "btn_Cancel" ;
action = "(done_dialog 0)" ;
is_default = true ;
label = "Cancel" ;
}// button
} //row
: spacer {
}// spacer
} // TitleRevUpdate
The key to edit box alignment in standard DCL is to set the width
attribute to be the same for all edit boxes (and large enough to accommodate the text and editing area of the largest edit box in the group), set the fixed_width
attribute to true
for all edit boxes, and then control the size of the edit box itself using the edit_width
attribute.
You don't need separate text
tiles when working with edit boxes, instead, you can use the label
attribute of the edit_box
tile.
For example, the upper section of your DCL could be revised to the following:
TitleRevUpdate : dialog
{
key = "Title" ;
label = "Update Title Block and Revision" ;
spacer;
// Title
: boxed_column
{
label = "Title" ;
// Client
: boxed_column
{
label = "Client" ;
: edit_box
{
label = "Client's Name:";
key = "edbx_Client_Name";
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
: edit_box
{
label = "Client's Location:" ;
key = "edbx_Client_Loc" ;
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
spacer;
}
spacer;
// Job
: boxed_column
{
label = "Job";
: edit_box
{
label = "Job's Name:";
key = "edbx_Job_Name";
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
: edit_box
{
label = "Job's Number:" ;
key = "edbx_Job_Number" ;
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
spacer;
}
spacer;
// Miscellaneous
: boxed_column
{
label = "Miscellaneous" ;
: edit_box
{
key = "edbx_Creator_Name" ;
label = "Creator's Name:" ;
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
: edit_box
{
key = "edbx_TitleDate" ;
label = "Date:" ;
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
: edit_box
{
key = "edbx_Issued_For" ;
label = "Issued For:" ;
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
spacer;
}
spacer;
}
spacer;
// Return Commands
: row
{
key = "Row_Return" ;
fixed_width = true;
alignment = centered;
: button
{
key = "btn_DWGs" ;
action = "(done_dialog 2)" ;
label = "Drawings" ;
fixed_width = true;
width = 16;
}
: button
{
key = "btn_Confirm" ;
action = "(done_dialog 1)" ;
is_enabled = true ;
label = "Confirm" ;
fixed_width = true;
width = 16;
}
: button
{
key = "btn_Cancel" ;
action = "(done_dialog 0)" ;
is_default = true ;
label = "Cancel" ;
fixed_width = true;
width = 16;
}
}
spacer;
}
To yield the following GUI:
And given that all of the tiles are sharing the same attribute values, you can define a named tile to condense the code much further, e.g.:
myeditbox : edit_box
{
alignment = left;
width = 52;
fixed_width = true;
edit_width = 30;
}
mybutton : button
{
fixed_width = true;
width = 16;
}
TitleRevUpdate : dialog
{
key = "Title" ;
label = "Update Title Block and Revision" ;
spacer;
: boxed_column
{
label = "Title" ;
: boxed_column
{
label = "Client" ;
: myeditbox { label = "Client's Name:"; key = "edbx_Client_Name"; }
: myeditbox { label = "Client's Location:"; key = "edbx_Client_Loc" ; }
spacer;
}
spacer;
: boxed_column
{
label = "Job";
: myeditbox { label = "Job's Name:"; key = "edbx_Job_Name"; }
: myeditbox { label = "Job's Number:"; key = "edbx_Job_Number"; }
spacer;
}
spacer;
: boxed_column
{
label = "Miscellaneous" ;
: myeditbox { label = "Creator's Name:"; key = "edbx_Creator_Name"; }
: myeditbox { label = "Date:"; key = "edbx_TitleDate"; }
: myeditbox { label = "Issued For:"; key = "edbx_Issued_For"; }
spacer;
}
spacer;
}
spacer;
: row
{
key = "Row_Return" ;
fixed_width = true;
alignment = centered;
: mybutton { key = "btn_DWGs"; action = "(done_dialog 2)"; label = "Drawings"; }
: mybutton { key = "btn_Confirm"; action = "(done_dialog 1)"; label = "Confirm"; is_enabled = true; }
: mybutton { key = "btn_Cancel" ; action = "(done_dialog 0)"; label = "Cancel"; is_default = true; }
}
spacer;
}