Autofill get from first chatacter

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

Autofill get from first chatacter

Post by Frank Demont »

Hello,

Next code did work with previous versions from fw , now it fails :

Code: Select all

#include "FiveWin.ch"

function Main()
   LOCAL oDlg , butok
   LOCAL cCad := "         " 
   DEFINE DIALOG oDlg TITLE "TGet from " + FWDESCRIPTION
   @ 1,    2 SAY "Text..:" OF oDlg
   @ 1,    6 GET oGet VAR cCad OF oDlg SIZE 60, 10 COLOR "W/G" PICTURE "@K"   ;
ON CHANGE VulGetAan(oGet , {"E","P"} , {"e-mail","Pakjes"} , ButOk)//tracelog(oGet[3]:nLastKey )
   @ 3,    7 BUTTON ButOk PROMPT "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED 

return nil
//------------------------------------------------------------------------//
PROC VulGetAan(oGet, ArrCode , ArrVal , ButOk)
**********************************************
LOCAL x := CHR(oGet:nLastKey) , i
IF x == CHR(13)
	ButOk:setFocus()
END

tracelog(x , oGet:nPos)
IF oGet:nPos > 1
	RETURN
END
IF ( i := ASCAN(ArrCode , x) ) > 0
	oGet:oGet:Buffer := ArrVal[i]
	oGet:Assign()
	oGet:Refresh()
END
RETURN

It seems that now oGet:nPos starts with 2 , changing

IF oGet:nPos > 1 in oGet:nPos > 2

Then it works

Another problem is that the cursor remains on position 1 , i can't move it to the next position.

I tryed with oGet:Setpos(3) , oGet:npos := oGet:oGet:npos := 3 , ......

Frank
Post Reply