Get search on TopBar of a Xbrowse

Get search on TopBar of a Xbrowse

Postby Silvio.Falconi » Fri May 28, 2021 11:54 am

I need to enter the search with the get control at the top of the xbrowse and also the combobox to select the column on which to search

Image

while the combobox run ok ( change the oBrowse:cFilterFld and refresh the xbrowse)
when I digit a letter then the data is not searched

Code: Select all  Expand view  RUN


Function test()

  local cSeek := Space( 100 )
   local oGet
    local oBrowse
....

  @ 140,10 XBROWSE oBrowse  ;
           SIZE -20,-40 PIXEL;
           OF oDlg ;
           DATASOURCE oReserva COLUMNS aBrowse NOBORDER

            PreGridReserva(oBrowse,oReserva,@oGet,@cSeek)

WITH OBJECT oBrowse
                       :MakeTotals()
                      :lfooter          := .T.
                      :ldrawborder:=.t.
                      :nClrBorder := CLR_GRAY
                      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
                      :lHscroll            := .F.
                      :l2007               := .F.
                      :l2015               := .T.

                       :lIncrFilter   := .t.
                      :oSeek         := oGet
                       :CreateFromCode()
         END


PreGridReserva(oBrowse,oReserva,@oGet,@cSeek)

Code: Select all  Expand view  RUN
STATIC Function PreGridReserva(oBrowse,oReserva,oGet,cSeek)
        local  cHead    := "Numero"
        local oCbx

      oBrowse:nTopBarHeight := 60
      oBrowse:SetStyle( 2015 )
      oBrowse:bOnAdjust := <||
         local  aHead    := {"Cognome","Nome","Tipo","Numero"} // ArrTranspose( aBrowse )[ 2 ]
         local  oSay1,oSay2
         local nRow:= 20

          @ nRow,  11  SAY oSay1 Prompt "Cerca:"     SIZE  55,   24 PIXEL  OF  oBrowse
          @ nRow,  375 SAY oSay2 Prompt "in:"        SIZE  55,   24 PIXEL  OF  oBrowse

   @ nRow,75 GET oGet VAR cSeek SIZE 200,24 PIXEL OF oBrowse;
               BITMAP "GRID_CANCELLA" ACTION (cSeek    := Space( 100 ),oBrowse:Seek( "" ),;
                         oBrowse:refresh(),oGet:refresh())

    @ nRow, 400 COMBOBOX oCbx VAR cHead ITEMS aHead ;
          SIZE 150,200 PIXEL OF oBrowse ;
          ON CHANGE (SetIndexReserva(oCbx:NAT,oReserva),;
                      oBrowse:Seek( "" ), ;
                      oBrowse:cFilterFld := oBrowse:oCol( cHead ):cExpr, ;
                      oBrowse:refresh() ,;
                      oBrowse:SetFocus() )



      return nil
        >
        return nil



where is the error ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Get search on TopBar of a Xbrowse

Postby Silvio.Falconi » Mon May 31, 2021 10:07 am

I tried also the original test of Nages adding the get of search on topbar xbrowse

Image


while the combobox seem to work good refreshing the xbrowse , the get not search any info

Code: Select all  Expand view  RUN


   #include "fivewin.ch"

    REQUEST DBFCDX

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

    function Main()

       local oDlg, oFont, oBrw, aCols, oGet, oCbx, cHead, aHead
       local cSeek    := Space( 100 )


       SET DATE ITALIAN
       SET CENTURY ON
       SET DELETED ON

       SetGetColorFocus()

       FERASE( "CUSTOMER.CDX" )
       USE CUSTOMER VIA "DBFCDX"
       FW_CdxCreate()
       SET ORDER TO TAG FIRST
       GO TOP

       aCols    := { ;
          { "FIRST",  "Nome",,      120, },;
          { "LAST",   "Cognome",,   120, },;
          { "STREET", "Indirizzo",, 180, },;
          { "CITY",   "Città",,     150, },;
          { "STATE",  "Stato",,      50, } }

       aHead    := ArrTranspose( aCols )[ 2 ]
       cHead    := "Nome"

       DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
       DEFINE DIALOG oDlg SIZE 800,600 PIXEL TRUEPIXEL FONT oFont


       /*
       @ 20, 20 COMBOBOX oCbx VAR cHead ITEMS aHead ;
          SIZE 150,200 PIXEL OF oDlg ;
          ON CHANGE ( oBrw:Seek( "" ), ;
                      oBrw:cFilterFld := oBrw:oCol( cHead ):cExpr, ;
                      oBrw:SetFocus() )

       @ 20,300 GET oGet VAR cSeek SIZE 480,24 PIXEL OF oDlg

        */



       @ 70, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
          DATASOURCE "CUSTOMER" COLUMNS aCols ;
          AUTOSORT CELL LINES NOBORDER


            TopBarXbrowse(@cSeek,@oGet,oBrw,aHead,cHead)


       WITH OBJECT oBrw
          :lIncrFilter   := .t.
          :oSeek         := oGet
          //
          :CreateFromCode()
       END

       ACTIVATE DIALOG oDlg CENTERED ON INIT oBrw:SetFocus()
       RELEASE FONT oFont

    return nil

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


    Function TopBarXbrowse(cSeek,oGet,oBrw,aHead,cHead)
        local oCbx

      oBrw:nTopBarHeight := 60
      oBrw:SetStyle( 2015 )
      oBrw:bOnAdjust := <||
         local  oSay1,oSay2
         local nRow:= 20

          @ nRow, 20 COMBOBOX oCbx VAR cHead ITEMS aHead ;
          SIZE 150,200 PIXEL OF oBrw ;
          ON CHANGE (SetIndex(oBrw,oCbx:nAt), oBrw:Seek( "" ), ;
                      oBrw:cFilterFld := oBrw:oCol( cHead ):cExpr, ;
                      oBrw:SetFocus() )

       @ nRow,250 GET oGet VAR cSeek SIZE 200,24 PIXEL OF oBrw

      return nil
        >


        return nil
//--------------------------------------------------------------------------------/

      Function SetIndex(oBrw,n)
         Do case
            Case n= 1
               SET ORDER TO TAG FIRST
            Case n= 2
                  SET ORDER TO TAG LAST
            Case n= 3
                  SET ORDER TO TAG STREET
            Case n= 4
                  SET ORDER TO TAG CITY
            Case n= 5
                  SET ORDER TO TAG STATE
               Endcase

        oBrw:refresh()
     return nil

 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 65 guests