Auto Seek Question from Xdemo
Posted: Thu Apr 01, 2010 7:16 am
In the example from Xdemo, Sample Group 2, "Auto Seek 1":
I would like the item in the browse that is highlighted to appear in the Get when "Enter" is pressed, and have the buttons "Yes/No" then receive focus.
What change/addition, please. Thank you.
I would like the item in the browse that is highlighted to appear in the Get when "Enter" is pressed, and have the buttons "Yes/No" then receive focus.
What change/addition, please. Thank you.
Code: Select all
FUNCTION XSample_43
/*
Browse with AUTOSEEK (DataBase)
This sample demonstrates a single @ DCSAY..GET and a Browse. The
GET is used to enter a string to seek.
*/
LOCAL GetList := {}, cSeek := Space(20), oBrowse
IF !File('..\XDOC\EXPRESS.DBF')
DC_MsgBox({'Sorry. The database required to show this feature',;
'is not included in the demonstration version', ;
'or the ..\XDOC\EXPRESS.DBF file does not exist'})
RETURN nil
ENDIF
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX EXCLUSIVE ALIAS 'XDOC'
SET INDEX TO EXPRESS.CDX
OrdSetFocus('COMMAND')
SET DEFA TO
@ 1,1 DCSAY 'Seek' GET cSeek SAYRIGHT PICT '@!' ;
KEYBLOCK {|a,b,o|_XSample_43(a,b,o,oBrowse,@cSeek)}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' SIZE 77,11.8
DCBROWSECOL FIELD XDOC->command HEADER "Command" PARENT oBrowse ;
WIDTH 7
DCBROWSECOL FIELD XDOC->type HEADER "Type" PARENT oBrowse ;
WIDTH 6
DCBROWSECOL FIELD XDOC->category HEADER "Category" PARENT oBrowse ;
WIDTH 6
DCBROWSECOL FIELD XDOC->short HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->see_also HEADER "See Also" PARENT oBrowse
DCBROWSECOL DATA {||XDOC->(recno())} HEADER "Record" PARENT oBrowse ;
WIDTH 4
DCREAD GUI ;
TITLE 'AUTOSEEK Demo' ;
FIT ;
ADDBUTTONS ;
MODAL
RETURN nil
/* ---------------------- */
STATIC FUNCTION _XSample_43( a, b, o, oBrowse, cSeek )
LOCAL lClearBuffer := .t., lSoftSeek := Set(_SET_SOFTSEEK,.t.)
IF a = xbeK_UP
oBrowse:up()
ELSEIF a = xbeK_DOWN
oBrowse:down()
ELSEIF a = xbeK_PGUP
oBrowse:pageup()
ELSEIF a = xbeK_PGDN
oBrowse:pagedown()
ELSEIF a = xbeK_END
oBrowse:gobottom()
ELSEIF a = xbeK_HOME
oBrowse:gotop()
ELSE
SEEK AllTrim(o:EditBuffer())
lClearBuffer := .f.
ENDIF
oBrowse:refreshall()
IF lClearBuffer
cSeek := Space(20)
o:Get:home()
o:setData()
ENDIF
Set(_SET_SOFTSEEK,lSoftSeek)
RETURN nil
*** END OF EXAMPLE ***