ON CHANGE help

ON CHANGE help

Postby Jeff Barnes » Sun Dec 03, 2006 12:42 am

Hi Everybody,

I am having a problem using the "ON CHANGE" clause of a get.

I want the program to run a function as the user enters data so I tried:

Code: Select all  Expand view
      REDEFINE GET oGetLast VAR cLastName ID 101 OF oSearch  ON CHANGE UpDateSearch() UPDATE


For some reason nothing appears in the get and if I do a MsgInfo( cLastName) it shows that no value was stored to cLastName.

If I change the ON CHANGE to a VALID (and leave the field) my function works fine but I want to check as the user types.

Any Ideas?

Thanks

Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Armando » Sun Dec 03, 2006 3:06 am

Jeff:

Perhaps you need an incremental search ?

Regards, Armando
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3085
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Jeff Barnes » Sun Dec 03, 2006 3:22 am

Yes ... this is what I am trying to do with a few fields.

Can you point me in the right direction?

Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Armando » Sun Dec 03, 2006 4:20 am

Jeff:

I use this one procedure

PROCEDURE Busca(cAlias,cKey,oBrw)
LOCAL nSeekRec := RECNO()
IF GETASYNCKEY(VK_BACK)
cKey := SUBSTR(cKey,1,LEN(cKey)-1)
ENDIF
IF ! (cAlias)->(DBSEEK(cKey,(.T.)))
GO nSeekRec
ENDIF
oBrw:REFRESH()
oBrw:oVScroll:SETPOS(RECNO())
RETURN

And this is the way to call to the procedure

REDEFINE GET aGets[1] VAR cBusca ID 101 OF oDlg UPDATE;
PICTURE "@!K";
ON CHANGE(SELF:ASSIGN(),;
Busca((cAlias),SUBSTR(cBusca,1,SELF:nPos-1)+UPPER(CHR(nKey)),oBrw),oBrw:REFRESH())

Best regards, Armando
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3085
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Armando » Sun Dec 03, 2006 4:26 am

Jeff:

I forgot to tell you that the incremental search works on the active index.

Regards, Armando
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3085
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby James Bott » Sun Dec 03, 2006 6:06 am

Jeff,

Use a DBCombo. It has built in incremental searching. You can use it with a DBF or an array.

See samples\testdbc1.prg for examples.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests