Jump to content

DCL alignment column


Kowal

Recommended Posts

I am trying to format the DCL window.

  : text {
 label = "Test DCL.";
 alignment = centered;
 }

 : row {
 
 : boxed_column {
 width = 10;
 alignment = left;
 fixed_width = true;
 
 : text {
 label = "1.";
 alignment = centered;
 }
 
 : text {
 label = "2.";
 alignment = left;
 }
 }

   : boxed_column {
   alignment = centered;
   width = 20;
 fixed_width = true;
 
 : text {
 label = "3.";
 alignment = right;
 }
 
 : text {
 label = "4.";
 alignment = left;
 }
 }
 
 }
 : row {
     : edit_box {
   label = "Test:";
     key = "Edit4";//Edit1$ from lsp file
     edit_width = 150.0;
     alignment = left;
     fixed_width = true;
   }
   }

 

The window looks like this:

 

DCL 1.jpg

 

How to move the column to the left does not change its width.

As in the picture below.

 

DCL 2.jpg

Link to comment
Share on other sites

Apply fixed_width = true to the row tile:

test : dialog
{
   : text
   {
       label = "Test DCL.";
       alignment = centered;
   }
   : row
   {
       [color=red]fixed_width = true;[/color]
       : boxed_column
       {
           width = 10;
           alignment = left;
           fixed_width = true;

           : text
           {
               label = "1.";
               alignment = centered;
           }
           : text 
           {
               label = "2.";
               alignment = left;
           }
       }
       : boxed_column
       {
           alignment = centered;
           width = 20;
           fixed_width = true;
 
           : text 
           {
               label = "3.";
               alignment = right;
           }
           : text 
           {
               label = "4.";
               alignment = left;
           }
       }
   } 
   : row 
   {
       : edit_box 
       {
           label = "Test:";
           key = "Edit4"; //Edit1$ from lsp file
           edit_width = 150.0;
           alignment = left;
           fixed_width = true;
       }
   }
   ok_cancel;
}

Link to comment
Share on other sites

Thank you for your help.

 

I have one more question.

 

How to make such formatting edit_box with label.

 

//---------------------------------------------------------------------------------------------------------
// MyEditText
//---------------------------------------------------------------------------------------------------------
MyEditText : dialog {
 key = "Title";
 label = "";//Title$ from lsp file
 : text {
 label = "DCL test.";
 alignment = centered;
 }

 initial_focus = "Edit1";
 spacer;
 //: row {
   : column {
     width = 5.09;
     fixed_width = true;
     spacer;
   }
   : edit_box {
   label = "BLK:";
     key = "Edit1";//Edit1$ from lsp file
     edit_width = 30.0;
     alignment = left;
     fixed_width = true;
   }
 
 initial_focus = "Edit2";
 spacer;
 //: row {
   : column {
     width = 5.09;
     fixed_width = true;
     spacer;
   //  : text {
     //  key = "Prompt1";
     //  label = "";//Prompt from lsp file
   //  }
   }
   : edit_box {
   label = "Attrib:";
     key = "Edit2";//Edit1$ from lsp file
     edit_width = 30.0;
     alignment = left;
     fixed_width = true;
   }
 //}
  initial_focus = "Edit3";
 spacer;
 //: row {
   : column {
     width = 5.09;
     fixed_width = true;
     spacer;
    // : text {
     //  key = "Prompt2";
     //  label = "";//Prompt from lsp file
    // }
   }
   : edit_box { 
     key = "Edit3";//Edit1$ from lsp file
     edit_width = 100.0;
     label = "Name:";
     alignment = left;
     fixed_width = true;
   }
 //}
 spacer;
 : row {
   fixed_width = true;
   alignment = centered;
   : ok_button {
     width = 10;
   }
   : cancel_button {
     width = 10;
   }
 }
}//MyEditText

 

The code makes a window like in the picture below.

 

DCL 3.jpg

 

How to align the edit_box to the left side like in the picture below.

 

DCL 4.jpg

Link to comment
Share on other sites

How to make such formatting edit_box with label.

 

How to align the edit_box to the left side like in the picture below.

 

Hi,

 

Divide edit_box tile into two tiles like this:

 

: row { : text { label = "BLK:"; } : edit_box { key = "Edit1";}}

 

Then add a space tile with specific width value to suit them in the alignment way you want it.

Link to comment
Share on other sites

There is no need for rows of separate text/edit_box tiles, simply adjust the width attribute to account for the largest label:

test : dialog
{
   spacer;
   : edit_box
   {
       key = "edit1";
       label = "Block:";
       width = 42.0;
       edit_width = 30.0;
       fixed_width = true;
       alignment = left;
   }
   : edit_box
   {
       key = "edit2";
       label = "Attrib:";
       width = 42.0;
       edit_width = 30.0;
       fixed_width = true;
       alignment = left;
   }
   : edit_box
   {
       key = "edit3";
       label = "Name:";
       width = 112.0;
       edit_width = 100.0;
       fixed_width = true;
       alignment = left;
   }
   ok_cancel;
}

 

The above yields:

 

editboxalignment.png

Link to comment
Share on other sites

I've followed Tharwat's advice and ended up with some nice results:

 

test1 : dialog
{ label = "EB Alignment test"; spacer_1;
 : column
 { alignment = centered; fixed_width = true; children_alignment = centered;
   : row { children_alignment = right; : text { label = "BLK:"; fixed_width = true; } : edit_box { key = "eb1"; fixed_width = true; }}
   : row { children_alignment = right; : text { label = "Attrib:"; fixed_width = true; } : edit_box { key = "eb2"; fixed_width = true; }}
   : row { children_alignment = right; : text { label = "Name:"; fixed_width = true; } : edit_box { key = "eb3"; fixed_width = true; }}
 }
 spacer_1; ok_only; spacer_1;
}

 

test2 : dialog
{ label = "EB Alignment test"; spacer_1;
 : column
 { alignment = centered; fixed_width = true; children_alignment = centered;
   : row { children_alignment = right; : text { label = "Name (First and Second):"; fixed_width = true; } : edit_box { key = "eb1"; fixed_width = true; }}
   : row { children_alignment = right; : text { label = "Age:"; fixed_width = true; } : edit_box { key = "eb2"; fixed_width = true; }}
   : row { children_alignment = right; : text { label = "Address:"; fixed_width = true; } : edit_box { key = "eb3"; fixed_width = true; }}
   : row { children_alignment = right; : text { label = "Email:"; fixed_width = true; } : edit_box { key = "eb4"; fixed_width = true; }}
 }
 spacer_1; ok_only; spacer_1;
}

 

They reminded me about his nice dialogs in his HVAC/Piping programs. 8)

 

However Lee's suggestion seems more suitable for the OP's dialog problem.

 

EB Alignment Test2.jpg

EB Alignment Test1.jpg

Link to comment
Share on other sites

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