right alignment

m1_ru

New Member
Define function:

<pre>
function str-right-align returns character
( input p-string as character
, input p-width as integer
) :
return fill(" ", max(p-width - length(p-string), 0) )
+ p-string
.
end function.
</pre>

Then use calculated field to display right-aligned field

<pre>
str-right-align(ub.goods.artic, 16) @ v-right-artic
</pre>

To right aligh label - simply insert some spaces at
the beginning of the label.
 
Hi m1_ru,

Thanks, this solution works but it requires rewriting the whole application. I'm looking for a very simple solution to right align text in browse widget. I found simple solution in case of editor and fill-in widget under Windows XP just pressing :
CTRL+LEFT SHIFT = align text to left
CTRL+RIGHT SHIFT = align text to right

It works also in updatable browse cell!

Note: user can use different fonts so we can not calculate the number of spaces we need.


Best regards,
Gabor
 

Samj

Member
Gabor

It is possible to calculate the size of a text field if you know the width of the widget.

ASSIGN
lv-char-lgth = FONT-TABLE:GET-TEXT-WIDTH-PIXELS(prcice-lbl)
lv-char-lgth = (widget-wdth - lv-char-lgth) / 4
price-col:LABEL IN BROWSE BROWSE-1 = price-lbl + FILL(" ",lv-char-lgth).

Also, in a freeform browse the column-label can be centered with: COLUMN-LABEL "Col-Label":C.

Sam
 
Top