"Starting With", "Containing"

"Starting With", "Containing"

Postby Silvio.Falconi » Fri Mar 10, 2023 10:26 am

I made the search on xbrowse with


@ 10, 165 GET oGet VAR cSeek.....

@ 10, 550 COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
SIZE 150,400 PIXEL OF oDlg HEIGHTGET 14.8 STYLE CBS_DROPDOWN


I'd like add also the options "Starting With", "Containing" on combobox but I not Know how make it

I saw this on xbincflt.prg


Code: Select all  Expand view  RUN
@ 10, 70 COMBOBOX nWild ITEMS { "Starting With", "Containing" } ;
      ON CHANGE ( oBrw:lSeekWild := ( nWild == 2 ), ;
                  oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ), ;
                  oBrw:SetFocus() ) ;
      SIZE 70,400 PIXEL OF oDlg




in my opinion these two options should be by default perhaps with a logical option like "lStartContain "
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: "Starting With", "Containing"

Postby Marc Venken » Fri Mar 10, 2023 11:32 am

From Mr. Rao...

Code: Select all  Expand view  RUN
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'

REQUEST DBFCDX

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

function Main()

   local oDlg, oBrw, oFont, nWild := 2
   local cList, aFlds, aHdrs
   local nChoice, uDataSource

   SET DATE ITALIAN
   SET CENTURY ON
   RDDSETDEFAULT( "DBFCDX" )

   cList := "First,Last,Street,State,HireDate"

   nChoice     := ALERT( "Choose Data Souce", { "DBF", "ADO", "ARRAY" } )
   uDataSource := OpenData( nChoice, cList )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12

   DEFINE DIALOG oDlg SIZE 750,300 PIXEL FONT oFont ;
      TITLE "XBrowse Incremental Filters"

   aFlds := aHdrs := HB_ATokens( cList, ',' )
   if nChoice == 3
      aFlds := Array( Len( aFlds ) )
      AEval( aFlds, { |u,i| aFlds[ i ] := i } )
   endif

   @ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      COLUMNS aFlds HEADERS aHdrs ;
      DATASOURCE uDataSource AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lIncrFilter   := .t.
      :lSeekWild     := ( nWild == 2 )
      :cFilterFld    := "FIRST"
      :nStretchCol   := STRETCHCOL_WIDEST
   END

   @ 10, 10 COMBOBOX oBrw:cFilterFld ;
      ITEMS aHdrs ;
      ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ;
      SIZE 50,400 PIXEL OF oDlg

   @ 10, 70 COMBOBOX nWild ITEMS { "Starting With", "Containing" } ;
      ON CHANGE ( oBrw:lSeekWild := ( nWild == 2 ), ;
                  oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ), ;
                  oBrw:SetFocus() ) ;
      SIZE 70,400 PIXEL OF oDlg

   @ 11,160 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,10 PIXEL ;
      OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )

   RELEASE FONT oFont

return nil

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

static function OpenData( nSource, cList )

   local oCn, uSource

   SWITCH nSource
   CASE 1
   CASE 3
      USE CUSTOMER SHARED NEW ALIAS CUST
      SET ORDER TO TAG FIRST
      GO TOP
      if nSource == 3
         uSource  := CUST->( FW_DbfToArray( cList ) )
         CLOSE CUST
      else
         uSource  := "CUST"
      endif
      EXIT
   CASE 2
      oCn   := FW_OpenAdoConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ;
                                      cFilePath( GetModuleFileName() ) + ;
                                      "xbrtest.mdb;User Id=admin;Password=;" )
      if oCn != nil
         uSource  := FW_OpenRecordSet( oCn, "CUSTOMER" )
      endif
      EXIT
   DEFAULT
      QUIT
   END

return uSource

//----------------------------------------------------------------------------//
 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: "Starting With", "Containing"

Postby Silvio.Falconi » Fri Mar 10, 2023 2:03 pm

Marc Venken wrote:From Mr. Rao...

Code: Select all  Expand view  RUN
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'

REQUEST DBFCDX

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

function Main()

   local oDlg, oBrw, oFont, nWild := 2
   local cList, aFlds, aHdrs
   local nChoice, uDataSource

   SET DATE ITALIAN
   SET CENTURY ON
   RDDSETDEFAULT( "DBFCDX" )

   cList := "First,Last,Street,State,HireDate"

   nChoice     := ALERT( "Choose Data Souce", { "DBF", "ADO", "ARRAY" } )
   uDataSource := OpenData( nChoice, cList )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12

   DEFINE DIALOG oDlg SIZE 750,300 PIXEL FONT oFont ;
      TITLE "XBrowse Incremental Filters"

   aFlds := aHdrs := HB_ATokens( cList, ',' )
   if nChoice == 3
      aFlds := Array( Len( aFlds ) )
      AEval( aFlds, { |u,i| aFlds[ i ] := i } )
   endif

   @ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      COLUMNS aFlds HEADERS aHdrs ;
      DATASOURCE uDataSource AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lIncrFilter   := .t.
      :lSeekWild     := ( nWild == 2 )
      :cFilterFld    := "FIRST"
      :nStretchCol   := STRETCHCOL_WIDEST
   END

   @ 10, 10 COMBOBOX oBrw:cFilterFld ;
      ITEMS aHdrs ;
      ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ;
      SIZE 50,400 PIXEL OF oDlg

   @ 10, 70 COMBOBOX nWild ITEMS { "Starting With", "Containing" } ;
      ON CHANGE ( oBrw:lSeekWild := ( nWild == 2 ), ;
                  oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ), ;
                  oBrw:SetFocus() ) ;
      SIZE 70,400 PIXEL OF oDlg

   @ 11,160 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 200,10 PIXEL ;
      OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )

   RELEASE FONT oFont

return nil

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

static function OpenData( nSource, cList )

   local oCn, uSource

   SWITCH nSource
   CASE 1
   CASE 3
      USE CUSTOMER SHARED NEW ALIAS CUST
      SET ORDER TO TAG FIRST
      GO TOP
      if nSource == 3
         uSource  := CUST->( FW_DbfToArray( cList ) )
         CLOSE CUST
      else
         uSource  := "CUST"
      endif
      EXIT
   CASE 2
      oCn   := FW_OpenAdoConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ;
                                      cFilePath( GetModuleFileName() ) + ;
                                      "xbrtest.mdb;User Id=admin;Password=;" )
      if oCn != nil
         uSource  := FW_OpenRecordSet( oCn, "CUSTOMER" )
      endif
      EXIT
   DEFAULT
      QUIT
   END

return uSource

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




I have another type of configuration, I'll explain briefly


Image


Code: Select all  Expand view  RUN


local  aCols    := { ;
                   { "COMUNE",  "Comune"   ,,   120, },;
                   { "PROV",    "Provincia",,   70, },;
                   { "CAP",     "Cap"      ,,   50, },;
                   { "CODREG",  "Regione"  ,,   80, } }


oDbf:=TComuni():New()
       oDbf:setorder(1)
       oDbf:Gotop()

 DEFINE DIALOG oDlg....


 DEFINE BUTTONBAR oBarDialog OF oDlg  SIZE 80,70  TOP NOBORDER  2015
 
 @ 12,15 say oSay[1] Prompt "Cerca" SIZE 46,24 PIXEL OF oDlg FONT oBold TRANSPARENT
 @ 12,450 say oSay[2] Prompt "in" SIZE 40,24 PIXEL OF oDlg FONT oBold    TRANSPARENT
       @ 10, 165 GET oGet VAR cSeek SIZE 200,19 PIXEL OF oDlg PICTURE "@!" ......


   @ 110,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
          DATASOURCE oDbf COLUMNS aCols ;
          AUTOSORT FONT oFont;
          NOBORDER CELL LINES


 WITH OBJECT oBrw
           :oSeek := oGet
            :CreateFromCode()
          END

   @ 10, 550 COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
        SIZE 100,400 PIXEL OF oDlg HEIGHTGET 14.8 STYLE CBS_DROPDOWN


ACTIVATE DIALOG oDlg CENTERED


 


I wish add on combobox also the option "start with" and "contain..."
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: "Starting With", "Containing"

Postby nageswaragunupudi » Mon Mar 13, 2023 2:36 am

I'd like add also the options "Starting With", "Containing" on combobox but I not Know how make it


XBROWSER.PRG already has the code for it.
Please adapt .
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: "Starting With", "Containing"

Postby Silvio.Falconi » Mon Mar 13, 2023 8:17 am

nageswaragunupudi wrote:
I'd like add also the options "Starting With", "Containing" on combobox but I not Know how make it


XBROWSER.PRG already has the code for it.
Please adapt .


yes I saw but I need to create this :

when I insert this line

@ 10, 550 COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
SIZE 100,400 PIXEL OF oDlg HEIGHTGET 14.8 STYLE CBS_DROPDOWN

add also "Starting With", "Containing"

on the same combobox and not on another combobox
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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