TGet bug?

User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

TGet bug?

Post by Enrico Maria Giordano »

In TGet:LButtonUp() method there is

elseif Empty( cText ) .or. cText == " / /" .or. ;
AllTrim( cText ) == "0" .or. ;
AllTrim( cText ) == " - -"

but I think that cText can never be exactly equal to " / /" and surely AllTrim( cText ) can never be exactly equal to " - -".

EMG
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Post by manuramos »

I think it's OK because ALLTRIM(" / / ") is exactly "/ /", in the same way ALLTRIM(" - - ") is exactly "- -", and is necesary.
Nos Gusta Programar
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

manuramos wrote:I think it's OK because ALLTRIM(" / / ") is exactly "/ /",
Yes, but the exact comparison is with " / / " (note that it starts with a space).
manuramos wrote:in the same way ALLTRIM(" - - ") is exactly "- -", and is necesary.
And here the exact comparison is with " - - " (note the leading and trailing spaces).

EMG
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Post by manuramos »

Yes it's true. I don't know why. It seems a bug.
Nos Gusta Programar
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Post by manuramos »

Enrico, I'm remembering, tree years ago,more or less, I modified some methods of TGET class, and I released leading spaces. It's running OK.
Nos Gusta Programar
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

manuramos wrote:Enrico, I'm remembering, tree years ago,more or less, I modified some methods of TGET class, and I released leading spaces. It's running OK.
Sorry, I don't understand. Are you saying that you leaved or removed the leading spaces?

EMG
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Post by manuramos »

Excuse my english. I removed it.
Nos Gusta Programar
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

I guess the right code is ... .or. cText == " - -" without using AllTrim().

The other expressions seem fine.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Antonio Linares wrote:Enrico,

I guess the right code is ... .or. cText == " - -" without using AllTrim().

The other expressions seem fine.
I think not. If cText is an empty date it will be " - - " or " / / " (note the trailing space) and the exact comparison (==) will fail. Or am I wrong?

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

Please notice that there are three spaces in front: " - -"

It looks as a picture for US phone numbers.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Antonio Linares wrote:Enrico,

Please notice that there are three spaces in front: " - -"

It looks as a picture for US phone numbers.
Ok, right. But what about ... .or. cText == " / /"?

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

> cText == " / /"

It looks as an empty date (please notice that AllTrim() was not needed). There are two spaces before the first "/" and none after the last "/".

That seems to be the return from GetWindowText() when the date is empty. (edit: not sure about this, as a space may be typed after)
Last edited by Antonio Linares on Sun Feb 26, 2006 11:38 am, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Antonio Linares wrote:Enrico,

> cText == " / /"

It looks as an empty date (please notice that AllTrim() was not needed). There are two spaces before the first "/" and none after the last "/".

That seems to be the return from GetWindowText() when the date is empty.
Are you sure that GetWindowText() returns " / /" without the two trailing spaces? If yes then ok.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

The problem is that if a PICTURE is used that has a "/" or a "-" in the front, then the code will be wrong, as ::nPos should not be set to 1.

This may be the right code:

Code: Select all

      elseif Empty( cText ) .or. RTrim( cText ) == "  /  /" .or. ;
         AllTrim( cText ) == "0" .or. ;
         RTrim( cText ) == "   -  -"
What do you think ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply