Speed up wildseek in Xbrowse

Speed up wildseek in Xbrowse

Postby Marc Venken » Tue Nov 22, 2016 9:50 pm

Hey,

I'm using wildseek in xbrowse, but when I go to 60.000 tot 200.000 records it slows down the respons

Ok, maybe it is just my system, but I think the code can be better :oops:

The database is 1 field, C 150

database =
use fotofile NEW ALIAS foto VIA "DBFCDX"
and when created : INDEX ON foto->foto TAG foto TO TMP_FNAME MEMORY

Any suggestions ?

Code: Select all  Expand view


   cList := "foto"
   aFlds := aHdrs := HB_ATokens( cList, ',' )


   @ 520,0 XBROWSE oBrw SIZE 850,250 ;
      PIXEL OF oWnd font oFont3;
      DATASOURCE "nofoto" ;
      COLUMNS "ID","orgfoto","naam","pagina","RefLev","picfound" ;
      COLSIZES 50,150,250,50,150,50 ;
      AUTOSORT CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw
      :picfound:SetCheck()
      :nStretchCol   := 1
      :bChange       := { || SET_SCOPE(oBrw2),('foto')->(DBGOTOP()),oBrw2:Refresh(),oImage:Refresh(),oImage2:Refresh() }

      :CreateFromCode()
   END

   oBrw:aCols[6]:bClrStd := { || IF( !nofoto->picfound , { CLR_BLACK,CLR_HRED } , { CLR_HRED,CLR_WHITE } ) }

   @ 520,860 XBROWSE oBrw2 SIZE 550,250 ;
      PIXEL OF oWnd DATASOURCE "Foto";
      COLUMNS "foto" ;
      COLSIZES 500 ;
      CELL LINES NOBORDER FASTEDIT

   WITH OBJECT oBrw2
      :nStretchCol   := 1
      :lIncrFilter   := .t.
      :lSeekWild     := ( nWild == 2 )
      :cFilterFld    := "foto"

      :bChange       := { || oImage2:Refresh() }
      :CreateFromCode()
   END

   oBrw:CreateFromCode()

   @ 32,300 XIMAGE oImage SIZE 550,- 300 OF oWnd SOURCE nofoto->orgfoto
   @ 32,860 XIMAGE oImage2 SIZE 550,-300 OF oWnd SOURCE foto->foto

   WITH OBJECT oWnd
      :nWidth     := ScreenWidth()  //* 0.6
      :nHeight    := ScreenHeight() //* 0.6
   END

   @ 40,10 SAY oBrw2:oSeek PROMPT oBrw2:cSeek SIZE 200,20 PIXEL ;
      OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'

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

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

   oBrw:CreateFromCode()

   ACTIVATE WINDOW oWnd CENTERED

 


Code: Select all  Expand view

STATIC FUNCTION SET_SCOPE(oStru)
LOCAL cNName := alltrim(nofoto->reflev)

DBSELECTAREA( "foto" )
("foto")->( ORDSCOPE(0, cNName ) )
("foto")->(ORDSCOPE(1, cNName ) )
oStru:Refresh()

RETURN NIL

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

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 108 guests