Alignment of column CHAR in Xbrowse

Alignment of column CHAR in Xbrowse

Postby mauri.menabue » Tue Jul 25, 2017 11:01 pm

Hi all

Why when xBrowse display a column of type char (ALIG LEFT) are trimmed left spaces ?
Is it possible fix this ?

Es.: cStr := " Test" align is "Test"

TIA
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm

Re: Alignment of column CHAR in Xbrowse

Postby James Bott » Wed Jul 26, 2017 1:44 am

Mauri,

I don't understand what you are asking for.

Left trimming is what ALIGN LEFT means, so it would seem that it is not in need of fixing.

If you don't want left trimming then just leave off ALIGN LEFT.

Perhaps you want something else?

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Alignment of column CHAR in Xbrowse

Postby mauri.menabue » Wed Jul 26, 2017 7:59 am

Hi James
I post an image to explain better the problem
[img]
https://imageshack.com/i/po8DfT0Kp
[/img]

Regard,
Mauri
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm

Re: Alignment of column CHAR in Xbrowse

Postby James Bott » Wed Jul 26, 2017 3:23 pm

Mauri,

The xbrowse appears to be working correctly.

You could use ALIGN RIGHT, which is what one usually uses with numbers. That is what I would do.

Or, you could use something like strtran([fieldname]," ", chr(160)). This will replace spaces with an invisible character that looks like a space. I don't know if XBrowse can handle that character.

I just noticed that it appears that this is an item number. I always start item numbers with "1" plus however many zeros it takes to fill the field. Or, you could always make item numbers the same length by left padding them with zeros when needed. Either of these would solve your xbrowse problem.

Or, you could solve this without changes to the data file, you could define the column with strtran([fieldname]," ","0") . However, if this is an existing system this could cause problems if users try to type in leading zeros when searching for item numbers.

Or, with an existing system you could just replace all the item numbers in the file with strtran([fieldname]," ","0"). However, for awhile there would be a lot of confusion by users. Pre-existing documents would have no leading zeros, and new documents would. It could also create problems with existing item numbers in other files, like invoices etc. You would have to find and change all them too.

These are reasons why I always use item numbers of equal lengths.

The simplest thing to do is just ALIGN RIGHT.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests