DCL text label alignment to center

DCL text label alignment to center

Anonymous
Not applicable
3,263 Views
5 Replies
Message 1 of 6

DCL text label alignment to center

Anonymous
Not applicable

Hello everyone Smiley Happy

 

Im trying to make my first simple dcl with image_buttons and text centered below each one. I put the text with alignment = centered; but its not working.

 

Please help! Thanks in advance Smiley Happy

0 Likes
Accepted solutions (1)
3,264 Views
5 Replies
Replies (5)
Message 2 of 6

scot-65
Advisor
Advisor
Accepted solution

There are two THREE methods you can try where both EACH involve the use of spacers.

You can add a spacer at the beginning of the row, like tabbing, then adjust the other spacers as needed

or make the container row align center and just provide spacers in between the text tiles.

Both ALL methods require the container to have a fixed width (which means collapse as much as possible).

Fine tune by adding spaces inside the label's text value: label="  image 1".

 

 


:row {fixed_width=true; alignment=centered; :text {label="image 1";} :spacer {width=2.7;} :text {label="image 2";} :spacer {width=2.7;} :text {label="image 3";} :spacer {width=2.7;} :text_part {key="Tex004"; width=6.1;} }

 

The use of the tile :text will provide a buffer at the end of the text string where the longer the line of text,

the more the buffer becomes (the width of the individual characters also play a part). That said, I use

:text_part and assign a key and do not employ a label. From there, if the row is fixed_width, I will have

to assign a width to this text_part otherwise the string will become truncated. Once completed, go into

the set_tile area of the LSP file and assign a key label: (set_tile "Tex004" "image 4")

Key labels ARE case sensitive.

 

You can also try spacer_0; and spacer_1; but I rarely use them.

 

Now that I am thinking about this and your situation, you can try a row having only a fixed_width where

inside contains a spacer and four text_parts of equal widths. YES!!!

 

This DCL language has been around a while and all the "tiles" have different meanings even though they

are simply called a tile. In today's language there are containers and controls (VB). By looking at each tile,

determine if they are either a control (button) or a container (boxed_column). Observe the rule that all

controls must be inside a container. The :dialog is a container, however one can create "mini" containers

which I call modules, and build a dialog that contains combinations of module names. You already know of

one mini container and it's called OK_only.

 

Hope this helps.

 


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

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hello Scot,

 

Thanks for the detailed reply, I will try the spacer method. I actually was pulling my hair all day yesterday on this and end up with columns, I dont know if its the right way but it did center the text on each image.

 

Heres what I have so far:

	: row {
	   : column {
		  : text { label = "image 1"; width = 17.26; fixed_width = true; alignment = centered; } }
	   : column {
		  : text { label = "image 2"; width = 17.26; fixed_width = true; alignment = centered; } }
	   : column {
		  : text { label = "image 3"; width = 17.26; fixed_width = true; alignment = centered; } }
	   : column {
		  : text { label = "image 4"; width = 17.26; fixed_width = true; alignment = centered; } }
	}

 

0 Likes
Message 4 of 6

scot-65
Advisor
Advisor

🙂

 

I did provide yet another alternative method in the last paragraph of my first reply,

but the hint was not as prominent as I expected (I wanted you to think about it).

 

Look at this instead and tell me what you think:

 


:row { :column { :image {key="Img001";} :text_part {key="Tex001"; alignment=centered;} }//column :column { :image {key="Img002";} :text_part {key="Tex002"; alignment=centered;} }//column :column { :image {key="Img003";} :text_part {key="Tex003"; alignment=centered;} }//column :column { :image {key="Img004";} :text_part {key="Tex004"; alignment=centered;} }//column }//row

 

This architecture combines the image and the [associative] text into one container.

Since the container is a column, the text is centered vertically in the column, thus

guaranteeing desired alignment to each other.

 

If the text field becomes larger than the image tile, you might need to assign a fixed

width/width to either the text or the column (that is if the row has a fixed width)

and align center the image control. Play with it...

 

I have added comments "//" for your convenience.

 

There is no rule stating a container cannot be inside another container. Better yet,

look at this as if it were a tree structure as shown in your favorite file manager...

 

Hope this helps.

 


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

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hello Scot,

 

Thanks for the code it helps a lot and this one is more cleaner & pretty straightforward....it compressed my dcl file a lil. However when I used ":text_part" it wont show the text so I end up using ":text".

 

	: row {
		:column {
			: image_button { key = "im05"; height = 5.0; width = 18.0; fixed_width = true; fixed_height = true; color = graphics_background; }
			: text { width = 18; fixed_width = true; alignment = centered; label = "txt 05"; } }
		:column {
			: image_button { key = "im06"; height = 5.0; width = 18.0; fixed_width = true; fixed_height = true; color = graphics_background; }
			: text { width = 18; fixed_width = true; alignment = centered; label = "txt 06"; } }
		:column {
			: image_button { key = "im07"; height = 5.0; width = 18.0; fixed_width = true; fixed_height = true; color = graphics_background; }
			: text { width = 18; fixed_width = true; alignment = centered; label = "txt 07"; } }
		:column {
			: image_button { key = "im08"; height = 5.0; width = 18.0; fixed_width = true; fixed_height = true; color = graphics_background; }
			: text { lwidth = 18; fixed_width = true; alignment = centered; abel = "txt 08"; } }
	}// row end //

 

0 Likes
Message 6 of 6

scot-65
Advisor
Advisor

Looks good.

:text does not necessarily require a fixed width or a width, just the alignment.
If not mistaken, use width to only make it wider, fixed_width does nothing.

:text_part can have a label (I have employed this route many times as a header),
however I use the key= route if this tile is horizontally in-line to another tile
and I want to compress the line as much as possible (also, I will reuse the header
as information when a looping dialog).

From there, inside your LSP file, between the new_dialog call and the start_dialog
call, add the value of the key.

Example:
 :row {fixed_width=true;
  :text_part {key="Tex002"; width=10.8;}
  :edit_box {key="Edi001"; width=18.0;}
 }

And inside the LSP file:
  (set_tile "Tex002" "Destination:")

Hope this helps.

 


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

0 Likes