FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TGet bug?
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Tue Feb 21, 2006 05:56 PM

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

Posts: 219
Joined: Mon Dec 26, 2005 07:25 PM

TGet bug?

Posted: Tue Feb 21, 2006 05:59 PM

I think it's OK because ALLTRIM(" / / ") is exactly "/ /", in the same way ALLTRIM(" - - ") is exactly "- -", and is necesary.

Nos Gusta Programar
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Tue Feb 21, 2006 07:03 PM
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
Posts: 219
Joined: Mon Dec 26, 2005 07:25 PM

TGet bug?

Posted: Tue Feb 21, 2006 07:06 PM

Yes it's true. I don't know why. It seems a bug.

Nos Gusta Programar
Posts: 219
Joined: Mon Dec 26, 2005 07:25 PM

TGet bug?

Posted: Tue Feb 21, 2006 07:13 PM

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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Tue Feb 21, 2006 08:06 PM
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
Posts: 219
Joined: Mon Dec 26, 2005 07:25 PM

TGet bug?

Posted: Wed Feb 22, 2006 04:14 PM

Excuse my english. I removed it.

Nos Gusta Programar
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

TGet bug?

Posted: Sun Feb 26, 2006 07:08 AM

Enrico,

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

The other expressions seem fine.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Sun Feb 26, 2006 10:46 AM
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

TGet bug?

Posted: Sun Feb 26, 2006 11:01 AM

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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Sun Feb 26, 2006 11:09 AM
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

TGet bug?

Posted: Sun Feb 26, 2006 11:22 AM

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)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

TGet bug?

Posted: Sun Feb 26, 2006 11:28 AM
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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

TGet bug?

Posted: Sun Feb 26, 2006 11:34 AM
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:
      elseif Empty( cText ) .or. RTrim( cText ) == "  /  /" .or. ;
         AllTrim( cText ) == "0" .or. ;
         RTrim( cText ) == "   -  -"


What do you think ?
regards, saludos

Antonio Linares
www.fivetechsoft.com