TGet bug?

TGet bug?

Postby Enrico Maria Giordano » Tue Feb 21, 2006 5: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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby manuramos » Tue Feb 21, 2006 5:59 pm

I think it's OK because ALLTRIM(" / / ") is exactly "/ /", in the same way ALLTRIM(" - - ") is exactly "- -", and is necesary.
Nos Gusta Programar
manuramos
 
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Postby Enrico Maria Giordano » Tue Feb 21, 2006 7: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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby manuramos » Tue Feb 21, 2006 7:06 pm

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)

Postby manuramos » Tue Feb 21, 2006 7: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
manuramos
 
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Postby Enrico Maria Giordano » Tue Feb 21, 2006 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby manuramos » Wed Feb 22, 2006 4:14 pm

Excuse my english. I removed it.
Nos Gusta Programar
manuramos
 
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Postby Enrico Maria Giordano » Wed Feb 22, 2006 4:43 pm

Ah, ok.

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

Postby Antonio Linares » Sun Feb 26, 2006 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » 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)
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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » 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:
Code: Select all  Expand view
      elseif Empty( cText ) .or. RTrim( cText ) == "  /  /" .or. ;
         AllTrim( cText ) == "0" .or. ;
         RTrim( cText ) == "   -  -"


What do you think ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests