"@K" clausule : Clipper/xharbour <->FWH
Posted: Sun Nov 01, 2009 11:19 am
Hello,
A few days ago i started a thread regarding @K clausule in GET . I made some tests :
1) In clipper/Xharbour it works when a input field receive focus , the cursor will be on the first character
A field can become focus with the keyboard (ENTER , TAB) or with the mouse
Note that when we click on the second character from a field , first the field receive focus (cursor on the first character) , and we have to click twice to set the cursor on the second character.
This means that the field will not be erased when we set the cursor on the first character with the left arrow , or with the mouse when the cursor was in the field.
So we can avoid erasing by using left and right arrow before changing the first character
Important is also that we can press Ctrl-U to undo the changes from the input , the cursor is set on the first character and the K-clausule will be active again
2) In fwh the K-clausule works only when the input-field has become focus with the keyboard. Moving in the field with arrow or mouse deactivates the k-clausule (as in clipper) , we have no Ctrl-U to use , can only reactivate by leaving and reentering the field
It is not clear where we have to look in the FWH-code to change the setfocus method , so that it also works with the mouse.
Next method in tget seems to have as goal to reactivate the k-Clausule , but doesn't work :
Using bKeydown from the get , i have a solution , at least for me , using Ctrl-Home or Ctrl-U to reactivate K-clausule , Ctrl-Del to delete:
A few days ago i started a thread regarding @K clausule in GET . I made some tests :
1) In clipper/Xharbour it works when a input field receive focus , the cursor will be on the first character
A field can become focus with the keyboard (ENTER , TAB) or with the mouse
Note that when we click on the second character from a field , first the field receive focus (cursor on the first character) , and we have to click twice to set the cursor on the second character.
This means that the field will not be erased when we set the cursor on the first character with the left arrow , or with the mouse when the cursor was in the field.
So we can avoid erasing by using left and right arrow before changing the first character
Important is also that we can press Ctrl-U to undo the changes from the input , the cursor is set on the first character and the K-clausule will be active again
2) In fwh the K-clausule works only when the input-field has become focus with the keyboard. Moving in the field with arrow or mouse deactivates the k-clausule (as in clipper) , we have no Ctrl-U to use , can only reactivate by leaving and reentering the field
It is not clear where we have to look in the FWH-code to change the setfocus method , so that it also works with the mouse.
Next method in tget seems to have as goal to reactivate the k-Clausule , but doesn't work :
Code: Select all
METHOD GoHome() CLASS TGet
::oGet:Home()
if ::oGet:Type == "N" .or. "K" $ upper(::oGet:Picture) // flag to clear buffer if typing is detected , James Bott
::oGet:Clear := .t.
endif
::SetPos( ::oGet:Pos )
return Self
Code: Select all
oGet:bKeyDown := {|nKey|IIF(GetKeyState(VK_CONTROL),(IIF(nKey==VK_DELETE,WisVeld(oGet),;
IIF(nKey==85,GetUndo(oGet),IIF(nKey==VK_HOME,oGet:Refresh(),)))),)}
PROC WisVeld(oGet)
******************
LOCAL x
IF oGet:oGet:Type=="C"
x:= SPACE(LEN(oGet:Varget()))
ELSEIF oGet:oGet:Type=="N"
x:= 0
ELSEIF oGet:oGet:Type=="D"
x := CTOD("")
END
oGet:varput(x)
oGet:Refresh()
RETURN
********************************************
PROC GetUndo(oGet)
******************
oGet:Varput(oGet:oGet:Original)
oGet:Refresh()
RETURN