Browse box string text alignment

Moderator: Rathinagiri

Post Reply
User avatar
CalScot
Posts: 235
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Browse box string text alignment

Post by CalScot » Thu Mar 21, 2013 4:37 am

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: 5172
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Thu Mar 21, 2013 5:07 am

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: 202
Joined: Tue May 19, 2009 7:10 am
Been thanked: 1 time

Post by jayadevu » Thu Mar 21, 2013 5:53 am

Hi,

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

HTH,

Jayadev

User avatar
CalScot
Posts: 235
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Post by CalScot » Thu Mar 21, 2013 6:34 am

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: 5172
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Thu Mar 21, 2013 6:38 am

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: 235
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Post by CalScot » Thu Mar 21, 2013 6:45 am

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: 235
Joined: Thu Mar 21, 2013 12:22 am
Location: California
Been thanked: 1 time

Post by CalScot » Thu Mar 21, 2013 6:54 am

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

Post Reply