Browse box string text alignment

Moderator: Rathinagiri

Post Reply
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Browse box string text alignment

Post 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.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Browse box string text alignment

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
jayadevu
Posts: 238
Joined: Tue May 19, 2009 7:10 am

Re: Browse box string text alignment

Post by jayadevu »

Hi,

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

HTH,

Jayadev
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Browse box string text alignment

Post 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!
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Browse box string text alignment

Post by Rathinagiri »

In that case, you can use the fixed width fonts like courier new or fixedsys.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Browse box string text alignment

Post 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!!!
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Browse box string text alignment

Post by CalScot »

Perfect!!
At this rate, I'll soon be back to programming instead of fighting the system!
Thanks again!
Post Reply