Entering a negative number in tGet

Entering a negative number in tGet

Postby Frank Demont » Tue Jun 06, 2006 10:29 am

Hello,

3 weeks ago i asked the same question , but i was on vacation for two weeks , so i try it again

In mine main aplication i have a dialog from resources , with a lot of get's (numeric value)

Each numeric get has a picture clause :

REDEFINE GET oGet VAR nInp ID 157 PICTURE "@K #99" OF Odlg

Entering a value as -99 , give no problems (no reformatting is needed)

BUT :

entering -9 , pressing TAB or ENTER reformats the get WITHOUT '-' SIGN !!!

Testing with testget2 , changing the get in REDEFINE GET ... to have the same situation give no problems !!!!

So i tryed to change tget.prg in METHOD KeyChar( nKey, nFlags )

case nKey == VK_TAB .or. nKey == VK_RETURN
trace(::oget:buffer,::varget()) // Shows -9 , 0

Trace executes a msginfo , but the (wrong) reformatting is all ready executed

So it seems that something go wrong BEFORE this statement.but where ?

Using fw2.7 , march , last xhb

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Frank Demont » Tue Jun 06, 2006 1:39 pm

The last i found is that in method lostfocus

if ! ::oGet:BadDate .and. ! ::lReadOnly .and. ;
( ::oGet:changed .or. ::oGet:unTransform() <> ::oGet:original )
::oGet:Assign() // for adjust numbers
# ifdef TEST
if ! Empty( ::cPicture ) .and. ::oGet:type == "N"
trace(::Varget() , ::lPassword , GetWindowText( ::hWnd ) , ::oGet:buffer)
end
# endif
::oGet:UpdateBuffer()
endif

::varget() is changed from negative to positive after ::oGet:Assign()

Where is this method ? In tget i see only :

METHOD Assign() INLINE ::oGet:Assign()

I suppose it is a tClipGet method , but don't find it

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Antonio Linares » Tue Jun 06, 2006 2:18 pm

Frank,

Method VarGet() is implemented in Class TControl.

What value has nInp before using it ?
REDEFINE GET oGet VAR nInp ID 157 PICTURE "@K #99" OF Odlg
regards, saludos

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

Postby Frank Demont » Tue Jun 06, 2006 5:01 pm

Antonio

It is important to me that this is fixed : my customer can't agree with an aplication where no negative numbers can't be entered.

Now , i have the modifyed tget.prg i use to test , linked in testget2.prg.

Now , i see a difference in method lostfocus.

In mine aplication seems for some reason ::oGet:Baddate seems to be set on .T. . So (In method lostfocus) , the sequens :


if ! ::oGet:BadDate .and. ! ::lReadOnly .and. ;
( ::oGet:changed .or. ::oGet:unTransform() <> ::oGet:original )
....

endif

is executed , and as i posted before ::oGet:Assign() changes in this case oget:varget() from negative in positive.

I do not understand at this moment why and how ::oGet:baddate become .T. , but probably the get becomes a non numeric value before the get become focus

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Antonio Linares » Tue Jun 06, 2006 5:34 pm

Frank,

samples\TestGet2.prg using PICTURE "@K #99" works ok. Whats the difference with your code ? Do you store a number or a string in your variable ?

Could you provide a small and self contained sample to reproduce the problem ?
regards, saludos

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

Postby Frank Demont » Wed Jun 07, 2006 7:11 am

Antonio

Executing this code from method lostfocus give as difference :
if ! Empty( ::cPicture ) .and. ::oGet:type == "N"
//tracelog(::Varget())
::oGet:Assign()
::oGet:Picture := ::cPicture
::oGet:UpdateBuffer()
::oGet:KillFocus()
endif

::oGet:SetFocus() // to avoid oGet:buffer be nil

# ifdef TEST
trace( ::oGet:changed , ::oGet:unTransform() , ::oGet:original)
// Main aplication : .F. , 1 , -1
// testget2 /.F. , -1 , -1
# endif



In the main aplication :

Inputvalue 1 changed in -1 , ::oGet:untransform() gives 1 , so the next If .... then is executed

In testget2.prg

Inputvalue 0 is changed in -1 , ::oGet:untransform() gives -1 , so the next If .... then is NOT executed

In both aplications is the same tget linked in !

Placing the trace statement :

before killfocus gives correct result (.T. , -1 , 1 )
after killfocus .T. , nil , nil

I am testing on get with a numeric value. This valus is not changed by other mechanism

Frank


Where is the code from ::oget:untransform() ?????
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Enrico Maria Giordano » Wed Jun 07, 2006 8:56 am

Frank, please take the time to build a reduced and self-contained sample of the problem. Otherwise it will be very difficult to help you.

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

Postby Antonio Linares » Wed Jun 07, 2006 10:23 am

Frank,

> Where is the code from ::oget:untransform() ?????

Its at harbour/xharbour (source code) Class Get.
regards, saludos

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

Postby Frank Demont » Fri Jun 09, 2006 7:29 am

Antonio,

Thanks for the info , now i found it . It works as expected

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Enrico Maria Giordano » Fri Jun 09, 2006 8:09 am

What was the problem?

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

Postby Frank Demont » Fri Jun 09, 2006 10:47 am

Enrico

In mine main aplication was the xhb-function IsdIGIT(str) overwritten by isdigit(Str,count) , as in funcky .

This function gives a wrong result for str==CHR(32) , so in ::untransform ::minus wasn't set corectly

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby Enrico Maria Giordano » Fri Jun 09, 2006 12:13 pm

Ok, thank you.

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft, nageswaragunupudi and 89 guests