// \samples\XBRWGET.PRG
#Include "FiveWin.ch"
#Define CLR_LGREEN nRGB( 190, 215, 190 )
#Define CLR_SOFTYELLOW nRGB( 255, 251, 225 )
ANNOUNCE RDDSYS
REQUEST DBFCDX, DBFFPT
FUNCTION Main()
LOCAL oDlg, oFont, oBrw, aCols, oGet, oCbx, cHead, aHead, aGrad, cTitle
LOCAL cSeek := SPACE( 100 )
SET DATE BRITISH
SET CENTURY ON
SET DELETED ON
tGet():lDisColors := .F.
tGet():nClrTextDis := CLR_HBLUE
tGet():nClrPaneDis := CLR_SOFTYELLOW
SetGetColorFocus( CLR_LGREEN )
FERASE( "CUSTOMER.CDX" )
USE CUSTOMER VIA "DBFCDX"
FW_CdxCreate() // CREA TU PROPIO INDICE.
SET ORDER TO TAG FIRST
GO TOP
aCols := { ;
{ "FIRST", "Nombre",, 120, }, ;
{ "LAST", "Apellido",, 120, }, ;
{ "STREET", "Dirección",, 180, }, ;
{ "CITY", "Ciudad",, 150, }, ;
{ "STATE", "Estado",, 50, } }
aHead := ArrTranspose( aCols )[ 2 ]
cHead := "Nombre"
// aGrad := { { 0.30, CLR_BLACK, CLR_YELLOW},{ 0.50, CLR_YELLOW, CLR_BLACK } }
aGrad := { { 0.30, CLR_CYAN, CLR_HCYAN },{ 0.50, CLR_HCYAN, CLR_CYAN } }
cTitle := "Busqueda Incremental Para José Alvarez"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, -14
DEFINE DIALOG oDlg TITLE cTitle SIZE 800, 600 PIXEL TRUEPIXEL FONT oFont ;
GRADIENT aGrad
oDlg:lHelpIcon := .F.
@ 20, 20 COMBOBOX oCbx VAR cHead ITEMS aHead ;
SIZE 150, 200 PIXEL OF oDlg ;
ON CHANGE ( oBrw:Seek( "" ), ;
oBrw:cFilterFld := oBrw:oCol( cHead ):cExpr, ;
oBrw:SetFocus() )
@ 20, 300 GET oGet VAR cSeek SIZE 466, 24 PIXEL OF oDlg ;
VALID( BUSCA_NOMBRE( cSeek, oBrw, oGet ) )
// ON CHANGE... Funciona?
@ 70, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" COLUMNS aCols ;
AUTOSORT CELL LINES NOBORDER
WITH OBJECT oBrw
:lIncrFilter := .T.
:lSeekWild := .T.
:oSeek := oGet
:bKeyDown := { |nKey| If( nKey == VK_RETURN, ( oDlg:End() ), NIL ) }
:bKeyChar := { |nKey| If( nKey == VK_ESCAPE, ( oBrw:Seek( "" ), oDlg:End() ), nil ) }
:bLDblClick := { || cSeek := oBrw:aRow[ 2 ], oDlg:End() }
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oBrw:cSeek( "" ), oBrw:SetFocus(), .F. )
RELEASE FONT oFont
RETURN NIL
FUNCTION BUSCA_NOMBRE( bSeek, oBrw, oGet )
LOCAL ErroSeek := SPACE( 100 )
SEEK( UPPER( bSeek ) )
IF FOUND()
oBrw:Refresh()
oBrw:SetFocus()
ELSE
SET SOFTSEEK ON
SEEK( UPPER( bSeek ) )
oGet:VARPUT( ErroSeek )
oGet:Refresh()
SET SOFTSEEK OFF
ENDIF
RETURN( .T. )
// FIN / END