Entering a negative number in tGet
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
Entering a negative number in tGet
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
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
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 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() ?????
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() ?????
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact: