Jump to content
Kowal

DCL alignment column

Recommended Posts

Kowal

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

Share this post


Link to post
Share on other sites
Lee Mac

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

Share this post


Link to post
Share on other sites
Kowal

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

Share this post


Link to post
Share on other sites
Tharwat

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.

Share this post


Link to post
Share on other sites
Lee Mac

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

Share this post


Link to post
Share on other sites
Grrr

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

Share this post


Link to post
Share on other sites
Tharwat

Good job Grrr and thanks for the nice words. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×