method seek Dolphin
Posted: Thu Jan 27, 2011 6:51 pm
La siguiente funcion yo la utilizo con tablas DBF, con un pequeño ajuste
funciona con tdolphin para buscar sobre una tabla de mysql,
la busqueda se realiza con el method seek, partiendo desde un GET, y el query se encuentra en un xbrowse.
acontinuacion un pedazo de codigo:
Saludos.
funciona con tdolphin para buscar sobre una tabla de mysql,
la busqueda se realiza con el method seek, partiendo desde un GET, y el query se encuentra en un xbrowse.
acontinuacion un pedazo de codigo:
Saludos.
Code: Select all
::oClientes := ::oMain:oCon:Query( "SELECT * FROM clientes ORDER BY nombre" )
@ 100, 10 GET oGet VAR ::cBuscar of oDlg SIZE 150, 24 PICTURE "@!k" PIXEL ;
ON CHANGE( oSelf:oGrid:Refresh(), oSelf:Buscar( nKey, oGet ) )
* busqueda incremental partiendo desde un objeto GET.
METHOD Buscar( nKey, oGet ) CLASS Clientes
local cFras
if nKey <> 13
if ( nKey >= 032 .OR. nKey <= 126 )
cFras:= upper( AllTrim( oGet:cTitle ) )
nSeek := ::oClientes:Seek( cFras, 2, , , .T.) // lSoft := .T.
if nSeek > 0
::oClientes:refresh()
else
::oClientes:Gotop()
::oClientes:refresh()
endif
endif
endif
::oGrid:refresh()
return .t.