Busqueda incremental

Post Reply
jaba
Posts: 109
Joined: Tue Dec 12, 2006 12:39 am
Location: CALI COLOMBIA

Busqueda incremental

Post by jaba »

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
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

jejejejejej

Post by leandro »

:oops:

Que pena la demora.... pero aqui esta el codigo de una de las formas como lo hago yo...

Code: Select all


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)
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
jaba
Posts: 109
Joined: Tue Dec 12, 2006 12:39 am
Location: CALI COLOMBIA

Re: jejejejejej

Post by jaba »

leandro wrote::oops:

Que pena la demora.... pero aqui esta el codigo de una de las formas como lo hago yo...

Code: Select all


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)
/**************************************************
Leandro

Muy agradecido por tu respueta la estare probando, y pena me da a mi quitarte tiempo cuando se que tienes poco.

Cordialmente

Jairo Barbosa
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Aqui tienes un ejemplo:

Code: Select all

#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

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
jaba
Posts: 109
Joined: Tue Dec 12, 2006 12:39 am
Location: CALI COLOMBIA

Post by jaba »

Antonio Linares wrote:Aqui tienes un ejemplo:

Code: Select all

#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

Expreso mi agradecimiento a ti y a Leandro por su colaboracion

Funciona Ok

Cordialmente

Jairo Barbosa
Post Reply