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
}
XBROWSE BUSQUEDA INCREMENTAL
- cuatecatl82
- Posts: 614
- Joined: Wed Mar 14, 2007 6:49 pm
- Location: San Cristobal de las Casas, Chiapas México
- Contact:
Re: XBROWSE BUSQUEDA INCREMENTAL
Saludos:
Yo hago mis búsquedas directamente en Xbrowse, en el SAY voy viendo que estoy digitando al buscar, y en el Get muestra el texto selecciono a la vez toma el foco la linea del xBrowse así, el listado lo muestra filtrado al buscar:
espero te sirva...
Yo hago mis búsquedas directamente en Xbrowse, en el SAY voy viendo que estoy digitando al buscar, y en el Get muestra el texto selecciono a la vez toma el foco la linea del xBrowse así, el listado lo muestra filtrado al buscar:
Code: Select all
STATIC oSayBrow,cSayBrow
--
WITH OBJECT oBrw:= TXBrowse():New(oDlg)
oCol:= oBrw:AddCol()
oCol:cHeader := "Listado de Productos"
oCol:nHeadStrAlign := AL_CENTER
oCol:oHeaderFont := oFtn
oCol:bStrData := { || (cAliBus)->NOMBRE}
oCol:nDataStrAlign := AL_LEFT
oCol:oDataFont := oFot
:lAllowRowSizing := .F.
:lAllowSizings := .F.
:nFreeze := 1
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:nHeaderLines := 2
:nStretchCol := STRETCHCOL_LAST
:lHScroll := .F.
:bSeek := Nil
:bKeyChar := {|nKey| IIF( nKey <> VK_RETURN .AND. nKey <> VK_ESCAPE, (EscribeBus(oBrw,nKey,cAliBus), oGet1:VarPut((cAliBus)->NOMBRE), oGet1:Refresh(), oGet2:VarPut((cAliBus)->PRECIO), oGet2:Refresh(), nStock:= (cAliBus)->STOCK, Existencia((cAliBus)->NOMBRE,oSay,"V")),(SysRefresh()))}
:bKeyDown := {|nKey| IIF( nKey == VK_RETURN, (lFinDlg:= .T., (cAliBus)->(CierraDBF()), oBrw:END(), oDlg:END(), oGet3:SetFocus()), (SysRefresh()))}
:bChange := {|| oGet1:VarPut((cAliBus)->NOMBRE), oGet1:Refresh(), oGet2:VarPut((cAliBus)->PRECIO), oGet2:Refresh(), nStock:= (cAliBus)->STOCK, Existencia((cAliBus)->NOMBRE,oSay,"V")}
:CreateFromResource( 101 )
END WITH
REDEFINE SAY oSayBrow PROMPT cSayBrow PICTURE "@!" ID 102 OF oDlg
//-----------------------------------------------------------------------------------------------------------------//
STATIC FUNCTION EscribeBus(oBrw,nKey,cAliBus)
IF nKey == VK_BACK .AND. ! EMPTY( cSayBrow )
(oBrw:cAlias)->(FiltroIncrmntal(oBrw,LEFT(cSayBrow,LEN(cSayBrow)-1),cAliBus))
RETURN 0
ELSEIF nKey > 31
(oBrw:cAlias)->(FiltroIncrmntal(oBrw,cSayBrow + CHR(nKey),cAliBus))
RETURN 0
ENDIF
RETURN Nil
//-----------------------------------------------------------------------------------------------------------------//
STATIC FUNCTION FiltroIncrmntal(oBrw,cPattern,cAliBus)
LOCAL cFilter, lFound:= .F.
LOCAL nRecNo, cSaveFilt, lStay
LOCAL cVersion:= ALLTRIM(UPPER(SUBSTR(VERSION(),1,8)))
IF VALTYPE(cPattern) == 'C'
IF EMPTY(cPattern)
cSayBrow:= ""
oSayBrow:SetText(cSayBrow)
SET FILTER TO !DELETED()
(cAliBus)->(DBGOTOP())
oBrw:Refresh()
lFound:= .T.
ELSE
IF cVersion == "XHARBOUR"
cFilter:= 'WildMatch( "*' + UPPER(cPattern) + '*", UPPER(DbRecordInfo( 9 ))) .AND. !DELETED()'
ELSEIF cVersion == "HARBOUR"
cFilter:= 'hb_WildMatch( "*' + UPPER(cPattern) + '*", UPPER(DbRecordInfo( 9 ))) .AND. !DELETED()'
ENDIF
cSaveFilt:= (cAliBus)->(DBFILTER())
nRecNo:= (cAliBus)->(RECNO())
lStay:= &cFilter
SET FILTER TO &cFilter
(cAliBus)->(DBGOTOP())
IF (cAliBus)->(OrdKeyCount()) == 0
SET FILTER TO &cSaveFilt
(cAliBus)->(DBGOTOP())
(cAliBus)->(DBGOTO(nRecNo))
ELSE
cSayBrow:= cPattern
oSayBrow:SetText(cSayBrow)
IF lStay
(cAliBus)->(DBGOTO(nRecNo))
oBrw:Refresh()
ELSE
oBrw:Refresh(.T.)
ENDIF
lFound:= .T.
ENDIF
ENDIF
ENDIF
RETURN lFound
espero te sirva...
Soluciones y Diseño de Software
Damos Soluciones...
I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos
http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
Damos Soluciones...
I.S.C. Victor Daniel Cuatecatl Leon
Director y Diseñador de Proyectos
http://www.soldisoft.unlugar.com
http://www.sisa.unlugar.com
danyleon82@hotmail.com
www.facebook.com/victordaniel.cuatecatlleon
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: XBROWSE BUSQUEDA INCREMENTAL
Mr Luis
May I know which version of FWH you are using?
If you are using any recent version which has inbuilt incremental filter feautue of xbrowse, we can help using the inbuilt feature. This is extremely simple to use.
This sample shows how simple is it to implement incremental filters:
But if you prefer to write your own incremental filter code, you need to support yourself.
May I know which version of FWH you are using?
If you are using any recent version which has inbuilt incremental filter feautue of xbrowse, we can help using the inbuilt feature. This is extremely simple to use.
This sample shows how simple is it to implement incremental filters:
Code: Select all
function incfilter
local oDlg, oBrw, oFont
USE CUSTOMER NEW VIA "DBFCDX"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 800,300 PIXEL FONT oFont
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg DATASOURCE "CUSTOMER" ;
COLUMNS "FIRST","LAST","CITY","STREET","SALARY" ;
CELL LINES AUTOSORT NOBORDER
WITH OBJECT oBrw
:lIncrFilter := .t.
:lSeekWild := .t.
:cFilterFld := "CITY"
//
:CreateFromCode()
END
@ 10,10 SAY oBrw:oSeek VAR oBrw:cSeek SIZE 100,10 PIXEL OF oDlg COLOR CLR_HRED,CLR_YELLOW
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
But if you prefer to write your own incremental filter code, you need to support yourself.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: XBROWSE BUSQUEDA INCREMENTAL
Mr.Rao
Can I do this with version 12.04?
Other, can you see this post? (sorry, was written in spanish)
http://forums.fivetechsupport.com/viewt ... 49#p150692
many thank
Can I do this with version 12.04?
Other, can you see this post? (sorry, was written in spanish)
http://forums.fivetechsupport.com/viewt ... 49#p150692
many thank
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: XBROWSE BUSQUEDA INCREMENTAL
Mr Mario
Incremental filters were first introduced in version 11.08 ( Aug 2011)
Should work in version 12.04
Please try the sample I posted.
I saw your other posting earlier. Honestly I could not understand what you wanted and so I could not answer you. I try again to understand.
Incremental filters were first introduced in version 11.08 ( Aug 2011)
Should work in version 12.04
Please try the sample I posted.
I saw your other posting earlier. Honestly I could not understand what you wanted and so I could not answer you. I try again to understand.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: XBROWSE BUSQUEDA INCREMENTAL
Mr Rao;
Thank for your respond (in other post too)
sorry for my english (I write from Google Traductor)
I put, xbrowse, in active the Multi selection
First, I selec with shift+clic or ctrl+clic, some registers.
after I do right clic (to open a popup), over a selection and ::aSelected only return the last register selected.
If I do again with Ctrl pressed. ::aSelected, returned all the registers, but not the register where I did clic.
How must i do it that?. This process is clean from Windows Explorer when do a copy files, for example
Thank for your respond (in other post too)
sorry for my english (I write from Google Traductor)
I put, xbrowse, in active the Multi selection
First, I selec with shift+clic or ctrl+clic, some registers.
after I do right clic (to open a popup), over a selection and ::aSelected only return the last register selected.
If I do again with Ctrl pressed. ::aSelected, returned all the registers, but not the register where I did clic.
How must i do it that?. This process is clean from Windows Explorer when do a copy files, for example
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina
Re: XBROWSE BUSQUEDA INCREMENTAL
sorry!; i write in the ohter post now
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina