Como estan :
Quisiera hacer búsqueda incremental encontré una solución en el foro pero cuando la aplico a mi programa no responde sale como caracteres extraños cuando digito y fuera de sitio en el GET y en el XBROWSE no sale nada. Alguna sugerencia?. Muchas Gracias.
#include "FiveWin.Ch"
#include 'ord.ch'
#Include "XBrowse.Ch"
#include 'hbcompat.ch'
#include "Report.ch"
static cNom
static oGet
FUNCTION Sys650(oWPpal)
LOCAL oWnd, oDlg, oIco, oLbx, oFont, nNroReg, oBtn[6], n
USE MAEREP INDE MAEREP1,MAEREP2,MAEREP3 SHARED ALIAS MAEREP NEW
DEFINE ICON oIco RESOURCE "MAEREP"
DEFINE FONT oFont NAME "Arial Negrita" SIZE 0,-13
DEFINE WINDOW oWnd FROM 0.0,0.5 TO 40.7,135.10;
TITLE "Maestro de Articulos "+"["+PROCNAME()+"]";
ICON oIco;
MDICHILD OF oWPpal
SET MESSAGE TO ("Gestion y mantenimiento del Maestro de Articulos, elija su opcion") OF oWnd
DEFINE DIALOG oDlg RESOURCE "Mantenimientos2" OF oWnd FONT oFont
dbSelectArea("MAEREP")
MAEREP->(OrdSetFocus("MAEREP1"))
REDEFINE XBROWSE oLbx ;
FIELDS MAEREP->Codgru,;
Oemtoansi(MAEREP->Grudes),;
TRANSFORM(MAEREP->Codigo,"@R 99.999.99.99"),;
Oemtoansi(MAEREP->Descrip),;
TRANSFORM(MAEREP->Costo,"9,999.9999"),;
TRANSFORM(MAEREP->Stk_min,"999,999"),;
TRANSFORM(MAEREP->Stk_max,"999,999");
HEADERS "C.Grupo","Grupo","Codigo","Descripcion","Costo","Stk_min","Stk_max";
FIELDSIZES 50, 170, 90, 380, 60, 60, 60, 60, 60, 60;
ON DBLCLICK (EditList(.F.,oWPpal), oLbx:Refresh() );
LINES ;
ID 172 OF oDlg
oLbx:aJustify := {.F.,.F.,.F.,.F.,.T.,.T.,.T.}
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
oLbx:bClrRowFocus := { || { CLR_WHITE, RGB( 0,150,193 ) } }
oLbx:aCols[01]:cSortOrder := "MAEREP3"
oLbx:aCols[03]:cSortOrder := "MAEREP1"
oLbx:aCols[04]:cSortOrder := "MAEREP2"
REDEFINE BTNBMP oBtn[1] ID 170 RESOURCE 1170 OF oDlg ACTION (EditList(.T.,oWPpal), oLbx:nRowSel := 1, oLbx:Refresh())
REDEFINE BTNBMP oBtn[2] ID 180 RESOURCE 1180 OF oDlg ACTION (EditList(.F.,oWPpal), oLbx:Refresh())
REDEFINE BTNBMP oBtn[3] ID 190 RESOURCE 1190 OF oDlg ACTION IF (Confirma("¨Deseas Borrar la entrada "+ALLTRIM(MAEREP->Descrip)+"?"),;
(MAEREP->(dbDelete()), oLbx:nRowSel:=1, oLbx:Refresh()), )
REDEFINE BTNBMP oBtn[4] ID 200 RESOURCE 1200 OF oDlg
REDEFINE BTNBMP oBtn[5] ID 210 RESOURCE 1210 OF oDlg ACTION ImprimList()
REDEFINE BTNBMP oBtn[6] ID 240 RESOURCE 1240 OF oDlg ACTION oWnd:End()
For n := 1 to 6
oBtn[n]:nClrPane = RGB(0,0,0)
Next
REDEFINE GET oGet VAR cNom ID 171 OF oDlg
oGet:bKeyDown := { | nKey | KeyChar( oLbx, nKey ) }
oLbx:bSeek := nil
oLbx:bKeyChar := { |nKey| KeyChar( oLbx, nKey ) }
ACTIVATE DIALOG oDlg NOWAIT ON INIT (oDlg:Move(0,0))
ACTIVATE WINDOW oWnd VALID Eval({|| dbCloseAll(), .T.})
RETURN NIL
static function KeyChar( oLbx, nKey )
If nKey == VK_BACK .and. ! Empty( cNom )
( oLbx:cAlias )->( IncrFilter( oLbx, Left( cNom, Len( cNom ) -1 ) ) )
return 0
elseIf nKey > 31
( oLbx:cAlias )->( IncrFilter( oLbx, cNom + Chr( nKey ) ) )
return 0
Endif
return nil
static function IncrFilter( oLbx, cPattern )
local cFilter, lFound := .f.
local nRecNo, cSaveFilt, lStay
if ValType( cPattern ) == 'C'
if Empty( cPattern )
cNom := ""
* oSeek:SetText( cSeek )
oGet:cText( cNom )
oGet:REFRESH()
SET FILTER TO !DELETED()
GO TOP
oLbx:Refresh()
lFound := .t.
else
cFilter := 'hb_WildMatch( "*' + Upper(cPattern) + '*", UPPER( OEMTOANSI(DESCRIP) )) .AND. !DELETED()'
cSaveFilt := DBFILTER()
nRecNo := RECNO()
lStay := &cFilter
SET FILTER TO &cFilter
GO TOP
if OrdKeyCount() == 0
SET FILTER TO &cSaveFilt
GO TOP
DBGOTO( nRecNo )
else
cNom := cPattern
oGet:cText( cNom )
oGet:REFRESH()
if lStay
DBGOTO( nRecNo )
oLbx:Refresh()
else
oLbx:Refresh( .t. )
endif
lFound := .t.
endif
endif
endif
return lFound
//---------------------------------------------------------
STATIC FUNCTION EditList(EsAlta,oWPpal)
RETURN NIL
//---------------------
STATIC PROCEDURE BUSGIR(aDat,vgItem1)
//---------------------
Local xgItem4 := aDat[Val(vgItem1)]
Return xgItem4
//----------------------
STATIC FUNCTION Grabadat(Grabar,Esalta,vVar)
RETURN NIL
//------------------------------------------------------------------
STATIC FUNCTION ImprimList()
RETURN NIL
//----------------------
STATIC PROCEDURE Regresa(xAlias)
LOCAL nRecno := 1
MsgStop("No Encontrado")
IF (xAlias)->(Eof())
// ?"1"
If (xAlias)->(Rlock())
// ?"2"
(xAlias)->(DbGoto(nRecno))
ENDIF
ENDIF
//?"3"
(xAlias)->(dbUnlock())
//?"4"
RETURN NIL
Aqui el archivo .RC
MANTENIMIENTOS2 DIALOG 5, 3, 535, 281
STYLE WS_CHILD | WS_VISIBLE
FONT 11, "Arial"
{
CONTROL "", 172, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 9, 37, 521, 212
EDITTEXT 171, 81, 260, 271, 15, WS_BORDER | WS_TABSTOP
ICON "shalamico", 199, 473, 9, 14, 14
CONTROL "", 170, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 26, 7, 41, 23
CONTROL "", 180, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 67, 7, 41, 23
CONTROL "", 190, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 108, 7, 41, 23
CONTROL "", 200, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 7, 41, 23
CONTROL "", 210, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 190, 7, 41, 23
CONTROL "", 240, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 231, 7, 41, 23
CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 470, 5, 27, 26
CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 472, 7, 23, 22
LTEXT "Localizar", -1, 34, 262, 43, 11
GROUPBOX "", 173, 21, -2, 256, 37, BS_GROUPBOX | WS_GROUP
GROUPBOX "", 174, 24, 2, 250, 30, BS_GROUPBOX | WS_GROUP
GROUPBOX "", 175, 7, 32, 526, 219, BS_GROUPBOX | WS_GROUP
GROUPBOX "", 176, 25, 252, 332, 26, BS_GROUPBOX | WS_GROUP
}