FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Incremental xBrowse search from GET
Posts: 38
Joined: Tue Jan 22, 2019 08:28 AM
Incremental xBrowse search from GET
Posted: Sun Feb 17, 2019 02:39 PM

Hola,

Utilizo la siguiente instruccion para que al introducir datos en un get busque lo introducido en el xbrowse:
oGet:bChange = { |n,f,oGet| oBrw:Seek( Trim( oGet:oGet:Buffer ) ), .t. }

Pero no se hacer que en el get no me deje introducir caracteres que no existen el la busqueda, por ejemplo, si busco "francisco" que no me deje introducir "franscisca", que el get se quede en "francisc"

Saludos,

Jorge

--------------------------------------------------

Fivewin 18.10 - Harbour - BCC 7 - PellesC

--------------------------------------------------
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Incremental xBrowse search from GET
Posted: Sun Feb 17, 2019 04:00 PM
Hola Jorge.
No recuerdo de donde saqué esto, pero hace lo que necesitas.
Intenta adaptarlo a tus necesidades.

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xBrowse.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   FIELD CODE,NAME

   local oDlg, oBrw, oFont

   FERASE( "STATES.CDX" )

   USE STATES VIA "DBFCDX"
   INDEX ON CODE TAG CODE
   INDEX ON UPPER(NAME) TAG NAME
   SET ORDER TO TAG CODE
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,400 PIXEL FONT oFont

   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE "STATES" ;
      COLUMNS "Code", "Name" ;
      HEADERS "StateCode", "StateName" ;
      AUTOSORT CELL LINES FOOTERS NOBORDER ;
      ON CHANGE ( ;
         If( Empty( oBrw:SelectedCol():cOrder ), ;
           ( oBrw:SelectedCol():SetOrder(), oBrw:Refresh() ), ;
         nil ) )

   WITH OBJECT oBrw
      :lColChangeNotify := .t.
      ***:lSortDescend     := .f.
      :bFooters         := { |oCol| If( Empty( oCol:cOrder ), "", oBrw:cSeek ) }
      :oSeek            := TSeek():New( oBrw )
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

CLASS TSeek STATIC

   DATA oBrw

   METHOD New( oBrw ) CONSTRUCTOR
   METHOD SetText( c ) INLINE ::oBrw:RefreshFooters()

ENDCLASS

METHOD New( oBrw ) CLASS TSeek

   ::oBrw   := oBrw

return Self

Saludos.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql

Continue the discussion