Page 1 of 1

Browse box string text alignment

Posted: Thu Mar 21, 2013 4:37 am
by CalScot
I’m trying to show browse box data as a single, read-only, selectable, highlighted line per record, but am having problems with vertical alignment. For example (with no trim functions involved):

FIELDS { ’Test->LastName + Space(10) + Test->FirstName + Space(10) + Test->City’ }

produces something like:

....Smith..........Alan......Los Angeles
....Davidson......Stanley........San Francisco
....Ng.............Art.......Sacramento

when what I'm trying to get is:

....Smith.........Alan...........Los Angeles
....Davidson...Stan..........San Francisco
....Ng.............Art.............Sacramento

(Edit: Sorry - that didn't come out well - spaces got stripped so I inserted dots to try to get the intended spacing; I hope you know what I mean.)

Using DBEdit() in DOS, with fixed-space characters, alignment was easy, but with GUI fonts…

I’ve searched for and tried all sorts of things (StrLen(), Tab(), pixel counts, etc.) but just can’t seem to find a solution, or even which direction to take. If anybody can help me with this, it would be much appreciated. Thanks.

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 5:07 am
by Rathinagiri
Hi,

Can you post a small sample?

Browse/Grid controls are having justification options for columns. I think you have to use that.

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 5:53 am
by jayadevu
Hi,

You can use padl() and padr() functions to achieve your objective.

HTH,

Jayadev

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 6:34 am
by CalScot
I'm trying to avoid "columns" as such, and to have the string of multiple fields appear as a single "column". I will try the padl() and padr() recommendations and let you know.
Thanks for the speedy responses!

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 6:38 am
by Rathinagiri
In that case, you can use the fixed width fonts like courier new or fixedsys.

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 6:45 am
by CalScot
Ah!!! A Fixedsys font! That makes sense, as I was beginning to think that I'd need to find a way to determine the kerned length of the data in each field for each record to be able to know the values to pass for the padl() or padr() options - which kinda put me back to square one.
It's almost midnight here, but I'm about to give that a try.
Thank you seems so inadequate, but thank you anyway!!!

Re: Browse box string text alignment

Posted: Thu Mar 21, 2013 6:54 am
by CalScot
Perfect!!
At this rate, I'll soon be back to programming instead of fighting the system!
Thanks again!