Antonio
Con mis buenos deseos para ti y para la gente del foro
Antonio Por favor como hago una busqueda incremental dese un listbox?
De antemano Gracias
Cordialmente
Jairo Barbosa
DEFINE DIALOG oDem11 RESOURCE "oDemu11" OF oWinp
REDEFINE BTNBMP oBsali ID 73 OF oDem11 FILENAME (oLamcla:iSali) NOBORDER ACTION oDem11:end()
REDEFINE GET oT1og1 VAR oT1vg1 ID 115 OF oDem11 ON CHANGE ( ::Assign(),;
IF(tCon->(DbSeek(AnsiToOem(Upper(SubStr(oT1vg1,1,::nPos-1))+;
Upper(Chr(nKey))))),(oT1oli:UpStable(),oT1oli:Refresh(),.t.),((""),.f.)))
SELE tConc
REDEFINE LISTBOX oT1oli VAR oT1vli;
FIELDS tConc->ACformat,tConc->ACconcep,tConc->ACnombre;
FIELDSIZES 50,50,150;
ID 110 OF oDem11;
HEADERS "Formato","Concepto","Nombre";
ON CHANGE pRefCon();
ON LEFT DBLCLICK (Grabar:="ModCon",pModCon())
oT1oli:nclrpane:=oLamcla:cComb
oT1oli:bKeyDown:={|nKey|iif(nKey==13,(Grabar:="ModCon",pModCon()),(" "))}
oDem11:cTitle := "Catálogo Conceptos"
ACTIVATE DIALOG oDem11
leandro wrote::oops:
Que pena la demora.... pero aqui esta el codigo de una de las formas como lo hago yo...
- Code: Select all Expand view
DEFINE DIALOG oDem11 RESOURCE "oDemu11" OF oWinp
REDEFINE BTNBMP oBsali ID 73 OF oDem11 FILENAME (oLamcla:iSali) NOBORDER ACTION oDem11:end()
REDEFINE GET oT1og1 VAR oT1vg1 ID 115 OF oDem11 ON CHANGE ( ::Assign(),;
IF(tCon->(DbSeek(AnsiToOem(Upper(SubStr(oT1vg1,1,::nPos-1))+;
Upper(Chr(nKey))))),(oT1oli:UpStable(),oT1oli:Refresh(),.t.),((""),.f.)))
SELE tConc
REDEFINE LISTBOX oT1oli VAR oT1vli;
FIELDS tConc->ACformat,tConc->ACconcep,tConc->ACnombre;
FIELDSIZES 50,50,150;
ID 110 OF oDem11;
HEADERS "Formato","Concepto","Nombre";
ON CHANGE pRefCon();
ON LEFT DBLCLICK (Grabar:="ModCon",pModCon())
oT1oli:nclrpane:=oLamcla:cComb
oT1oli:bKeyDown:={|nKey|iif(nKey==13,(Grabar:="ModCon",pModCon()),(" "))}
oDem11:cTitle := "Catálogo Conceptos"
ACTIVATE DIALOG oDem11
Mas tarde público la otra manera de hacerlo
Saludos
LEANDRO ALFONSO
Bogotá (Colombia)
#include "FiveWin.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oWnd, oBrw, hBmp := ReadBitmap( CurDir() + "\go.bmp" )
local oSay, cSearch := ""
USE ( CurDir() + "\Customer" ) VIA "DBFCDX"
if ! File( CurDir() + "\LAST.CDX" )
INDEX ON Customer->Last TO ( CurDir() + "\LAST" )
endif
Customer->( OrdSetFocus( "LAST" ) )
Customer->( DbGoTop() )
DEFINE WINDOW oWnd TITLE "IncSearch"
@ 1, 1 LISTBOX oBrw ;
FIELDS hBmp, Customer->Last, Customer->First ;
HEADERS "", "Last", "First" ;
SIZE 220, 167
oBrw:bKeyChar = { | nKey, nFlags | Search( nKey, @cSearch ), oBrw:Refresh(),;
oSay:Refresh() }
@ 14, 2 SAY "Searching:" SIZE 60, 30
@ 14, 12 SAY oSay PROMPT cSearch SIZE 80, 30
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function Search( nKey, cSearch )
if nKey = 8
cSearch = SubStr( cSearch, 1, Len( cSearch ) - 1 )
else
cSearch += Upper( Chr( nKey ) )
endif
Customer->( DbSeek( cSearch, .t. ) )
return nil
//----------------------------------------------------------------------------//
Antonio Linares wrote:Aqui tienes un ejemplo:
- Code: Select all Expand view
#include "FiveWin.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oWnd, oBrw, hBmp := ReadBitmap( CurDir() + "\go.bmp" )
local oSay, cSearch := ""
USE ( CurDir() + "\Customer" ) VIA "DBFCDX"
if ! File( CurDir() + "\LAST.CDX" )
INDEX ON Customer->Last TO ( CurDir() + "\LAST" )
endif
Customer->( OrdSetFocus( "LAST" ) )
Customer->( DbGoTop() )
DEFINE WINDOW oWnd TITLE "IncSearch"
@ 1, 1 LISTBOX oBrw ;
FIELDS hBmp, Customer->Last, Customer->First ;
HEADERS "", "Last", "First" ;
SIZE 220, 167
oBrw:bKeyChar = { | nKey, nFlags | Search( nKey, @cSearch ), oBrw:Refresh(),;
oSay:Refresh() }
@ 14, 2 SAY "Searching:" SIZE 60, 30
@ 14, 12 SAY oSay PROMPT cSearch SIZE 80, 30
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
//----------------------------------------------------------------------------//
function Search( nKey, cSearch )
if nKey = 8
cSearch = SubStr( cSearch, 1, Len( cSearch ) - 1 )
else
cSearch += Upper( Chr( nKey ) )
endif
Customer->( DbSeek( cSearch, .t. ) )
return nil
//----------------------------------------------------------------------------//
Return to FiveWin para CA-Clipper
Users browsing this forum: No registered users and 19 guests