problem with big dbf on xbrowse

Re: problem with big dbf on xbrowse

Postby karinha » Fri Jun 14, 2024 2:07 pm

Master Antônio, this command: oBrw:AutoFit() makes XBROWSE() extremely SLOW. Waiting for the assembly/display of XBROWSE() is unbearable, believe me, for the CUSTOMER, this is not acceptable under any circumstances.

Maestro Antônio, este comando: oBrw:AutoFit() hace que XBROWSE() sea extremadamente LENTO. Esperar el montaje/visualización de XBROWSE() es insoportable, créanme, para el CLIENTE, esto no es aceptable bajo ninguna circunstancia.

Code: Select all  Expand view

   This command makes XBROWSE() extremely slow Mister Nages.
   oBrw:AutoFit() // Auto ajuste / ajuste automatico do xBrowse()
 


RESUELTO:

Code: Select all  Expand view

// C:\SILXBRW2\SILVSLOW.PRG - Version: 02
// INICIO     EN: 12/06/2024
// MODIFICADO EN: 14/06/2024 - POR: Joao Santos.

#Include "Ambienty.ch"  // Todos os includes aqui.

#Define aPubGrad {| lInvert | If( lInvert, ;
                 { { 1 / 3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                 { 2 / 3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }    ;
                 },                                                         ;
                 { { 1 / 2, nRGB( 219, 230, 244 ), nRGB( 207 - 50, 221 - 25, 255 ) }, ;
                 { 1 / 2, nRGB( 201 - 50, 217 - 25, 255 ), nRGB( 231, 242, 255 ) }    ;
                 } ) }

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850 // PARA INDEXAR CAMPOS ACENTUADOS

ANNOUNCE RDDSYS // IDEM: ANNOUNCE FPTCDX
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto
REQUEST DBFCDX, DBFFPT

STATIC oWnd, oFont, nHFont, cFont, nWFont, cFontH, oFnt, oFont40
STATIC oMeter, oText, nOpcRadioEnde := 6
STATIC oFont1, oFont2, oFont3, cVersion := "2.0"

FUNCTION Main()

   LOCAL oBmp, oIco, oSaida, oHand, oBar

   PUBLIC XRESOLUCAO

   hb_gcAll( .F. ) // PARA LIMPAR A MEMORIA .F. -> Somente se tiver lixo.

   hb_langSelect( 'PT' )     // Default language is now Portuguese
   HB_SETCODEPAGE( "PT850" )

   rddSetDefault( "DBFCDX" )
   rddRegister( "DBFCDX", 1 )

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO Year( Date() ) - 30
   SET SOFTSEEK OFF
   SET WRAP ON
   SetCancel( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET _3DLOOK ON
   SET UNIQUE OFF
   SET ESCAPE OFF
   SET EXACT ON       // CONTROLA O :=, = e ==
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF
   SET OPTIMIZE ON

   cFont   := "Segoe UI Symbol"  // "Calibri"
   cFontH  := -14  // -10 //-12 //-16 //-18  //-20

   IF !IsWin8() .AND. !IsWindows10()
      cFont   := "Calibri"   // "Tahoma"
   ENDIF

   SetBalloon( .T. ) // Balloon shape required for tooltips

   SkinButtons()

   IF FILE( "AGUARDE.wav" )

      SndPlaySound( "AGUARDE.wav", 0 )

   ENDIF

   MsgRun( "ESPERE POR FAVOR... ABRIENDO BASES DE DATOS.",       ;
           "Espere hasta que se abra. Puede que tarde un poco.", ;
           { || WinExec( ABERTURA_DOS_BANCOS() ), 3 } )

   XRESOLUCAO := "R1024_768" // RESOLUTION

   DEFINE CURSOR oHand RESOURCE "Dedo"
   DEFINE ICON oIco    RESOURCE "ICONE02"  // EM IMAGENS.RES
   DEFINE FONT oFont   NAME cFont    SIZE 0, cFontH WEIGHT 300
   DEFINE FONT oFont40 NAME 'Tahoma' SIZE 0, - 40 BOLD

   DEFINE WINDOW oWnd TITLE "| xBrowse Sample | Version: " + cVersion        ;
      MENU BuildMenu() MENUINFO 3 ICON oIco MDI

   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oBar BUTTONSIZE 50, 54 _3DLOOK TOP OF oWnd 2007

   WITH OBJECT oBar

      oBar:bClrGrad := aPubGrad  // Preferi assim.

      oBar:SetFont( oFont )
      oBar:nClrText := CLR_HBLUE // BLACK
      oBar:Adjust()

   END

   DEFINE BUTTON OF oBar FILENAME ".\open.bmp" PROMPT "&Open" FLAT   ;
      ACTION( XBROWSE_SILV_SLOW() ) TOOLTIP "Abrir base de datos." GROUP

   DEFINE BUTTON OF oBar FILENAME ".\Index.bmp" PROMPT "&Index" FLAT ;
      ACTION( MsgMeter( { | oMeter, oText, oDlg, lEnd |              ;
                       CREA_INDICES( oMeter, oText, oDlg, @lEnd ) }, ;
            'Aguarde, Indexando Archivo...', 'Por Favor, Espere' ) ) ;
      TOOLTIP "Archivos de índice" GROUP

   DEFINE BUTTON OF oBar FILENAME ".\Exit.bmp" PROMPT "Exit" FLAT    ;
      ACTION( oWnd:End(), CIERRA_TODO() )                            ;
      TOOLTIP "Salir de la aplicación" GROUP

   SET MESSAGE OF oWnd TO "© João Santos - +55(11) 9.5150-7341 "     ;
      + "- joao@pleno.com.br" + " - www.pleno.com.br" FONT oFont     ;
      NOINSET CLOCK DATE KEYBOARD COLOR CLR_HBLUE, CLR_WHITE 2007

   DEFINE BITMAP oBmp FILENAME ".\sea.bmp"

   oWnd:bPainted = {| hDC | BmpTiled( hDC, oWnd, oBmp ) }

   ACTIVATE WINDOW oWnd MAXIMIZED

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu 2007

      MENUITEM "Información"

      MENU
         MENUITEM "&About..."               ;
            ACTION MsgInfo( FWDESCRIPTION ) ;
            FILENAME ".\info.bmp"

      SEPARATOR
      MENUITEM "&Finaliza"                   ;
         ACTION( oWnd:End(), CIERRA_TODO() ) ;
         FILENAME ".\exit.bmp"

      ENDMENU

   ENDMENU

RETURN( oMenu )

FUNCTION ABERTURA_DOS_BANCOS()

   PUBLIC DBSILVSLOW

   IF .NOT. FILE( "SILVSLOW.CDX" )

      CLOSE DATABASES

      USE SILVSLOW NEW EXCLUSIVE ALIAS SILVSLOW

      INDEX ON Field->FIRST  TAG 01 TO SILVSLOW FOR .NOT. DELETED()

      INDEX ON Field->LAST   TAG 02 TO SILVSLOW FOR .NOT. DELETED()

      INDEX ON Field->STREET TAG 03 TO SILVSLOW FOR .NOT. DELETED()

      INDEX ON Field->CITY   TAG 04 TO SILVSLOW FOR .NOT. DELETED()

      INDEX ON Field->STATE  TAG 05 TO SILVSLOW FOR .NOT. DELETED()

      CLOSE DATABASES

   ENDIF

   USE SILVSLOW ALIAS SILVSLOW INDEX SILVSLOW NEW SHARED

   SET ORDER TO 01

   DBSILVSLOW := ALIAS() // SILVSLOW.DBF

   GO TOP

RETURN NIL

FUNCTION CREA_INDICES( oMeter, oText, oDlg, lEnd )

   FIELD FIRST, LAST, STREET, CITY, STATE, MARRIED

   LOCAL nTotal := 100

   IF FILE( "SILVSLOW.CDX" )

      AEVAL(DIRECTORY( "SILVSLOW.CDX" ),{ |aFILE| FERASE(aFILE[F_NAME]) } )

   ENDIF

   CLOSE DATABASES

   USE SILVSLOW NEW EXCLUSIVE ALIAS SILVSLOW

   oMeter:nTotal = RecCount()

   INDEX ON Field->FIRST  TAG 01 TO SILVSLOW FOR .NOT. DELETED()           ;
      EVAL ( oMeter:Set( RecNo() ), CursorWait(), SysRefresh() ) EVERY 10

   INDEX ON Field->LAST   TAG 02 TO SILVSLOW FOR .NOT. DELETED()           ;
      EVAL ( oMeter:Set( RecNo() ), CursorWait(), SysRefresh() ) EVERY 10

   INDEX ON Field->STREET TAG 03 TO SILVSLOW FOR .NOT. DELETED()           ;
      EVAL ( oMeter:Set( RecNo() ), CursorWait(), SysRefresh() ) EVERY 10

   INDEX ON Field->CITY   TAG 04 TO SILVSLOW FOR .NOT. DELETED()           ;
      EVAL ( oMeter:Set( RecNo() ), CursorWait(), SysRefresh() ) EVERY 10

   INDEX ON Field->STATE  TAG 05 TO SILVSLOW FOR .NOT. DELETED()           ;
      EVAL ( oMeter:Set( RecNo() ), CursorWait(), SysRefresh() ) EVERY 10

   CLOSE DATABASES

   ABERTURA_DOS_BANCOS()

RETURN NIL

FUNCTION XBROWSE_SILV_SLOW()

   LOCAL oDlg, oGroup1, oGroup2, oFnt, oFont, IDCor, oSaida, aGet := ARRAY(5)
   LOCAL cAlias, oIncluir, oAlterar, oExcluir, oImprimir, oLbx, oRadMenu
   LOCAL oFont1, oFont2, oFont3

   HB_GCALL( .F. )

   SELECT( DBSILVSLOW )  // SILVSLOW.DBF

   cAlias := ALIAS()

   IF( XRESOLUCAO = "R1024_768" )

      DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -14 BOLD
      DEFINE FONT oFnt   NAME "Ms Sans Serif"  SIZE 00, -12 BOLD
      DEFINE FONT oFont1 NAME "Calibri"        SIZE 0,  -14
      DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0,  -18
      DEFINE FONT oFont3 NAME "Segoe UI"       SIZE 0,  -26

   ELSEIF( XRESOLUCAO = "R1280_768" )

      DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -16 BOLD
      DEFINE FONT oFnt   NAME "Ms Sans Serif"  SIZE 00, -12 BOLD
      DEFINE FONT oFont1 NAME "Calibri"        SIZE 0,  -16
      DEFINE FONT oFont2 NAME "Segoe UI Light" SIZE 0,  -20
      DEFINE FONT oFont3 NAME "Segoe UI"       SIZE 0,  -28

   ENDIF

   aGrad := { { 0.30, CLR_WHITE, CLR_WHITE },{ 0.50, CLR_WHITE, CLR_WHITE } }

   DEFINE CURSOR oCurDedo RESOURCE "Dedo"

   IF( XRESOLUCAO = "R1024_768" )

      DEFINE DIALOG oDlg RESOURCE "BROWSE_CAD_PROPOSTA_1024_768" GRADIENT aGrad

   ELSEIF( XRESOLUCAO = "R1280_768" )

      DEFINE DIALOG oDlg RESOURCE "BROWSE_CAD_PROPOSTA_1280_768" GRADIENT aGrad

   ENDIF

   oDlg:lHelpIcon := .F.

   REDEFINE RADIO oRadMenu VAR nOpcRadioEnde ID 201, 202, 203, 204, 205 OF oDlg ;
      UPDATE ON CHANGE( CAMBIAR_INDICE_SLOW( nOpcRadioEnde, cAlias, oLbx ),     ;
                        oLbx:Refresh(), oLbx:SetFocus() )

   // FIELD FIRST, LAST, STREET, CITY, STATE
   oRadMenu:aItems[1]:cTooltip := "Por FIRST"
   oRadMenu:aItems[2]:cTooltip := "Por LAST"
   oRadMenu:aItems[3]:cTooltip := "Por STREET"
   oRadMenu:aItems[4]:cTooltip := "Por CITY"
   oRadMenu:aItems[5]:cTooltip := "Por STATE"
   // oRadio:aItems[3]:Disable()  // DESABILITA O RADIO

   oRadMenu:SetFont( oFnt )

   REDEFINE SAY ID 404 OF oDlg COLORS CLR_BLACK, CLR_WHITE UPDATE FONT oFnt TRANSPARENT
   REDEFINE SAY ID 405 OF oDlg COLORS CLR_CYAN,  CLR_WHITE UPDATE FONT oFnt TRANSPARENT

   REDEFINE GROUP oGroup1 ID 501 OF oDlg COLOR CLR_ORANGE, CLR_WHITE FONT oFnt TRANSPARENT
   REDEFINE GROUP oGroup2 ID 502 OF oDlg COLOR CLR_ORANGE, CLR_WHITE FONT oFnt TRANSPARENT

   REDEFINE LISTBOX oLbx FIELDS                                              ;
            ( cAlias )->FIRST                                              , ;
            ( cAlias )->LAST                                               , ;
            ( cAlias )->STREET                                             , ;
            ( cAlias )->CITY                                               , ;
            ( cAlias )->STATE                                              , ;
            ( cAlias )->MARRIED                                            , ;
            SPACE(01)                                                        ;
            HEADERS ( OemToAnsi( "FIRST:"   ) )                            , ;
                    ( OemToAnsi( "LAST:"    ) )                            , ;
                    ( OemToAnsi( "STREET:"  ) )                            , ;
                    ( OemToAnsi( "CITY:"    ) )                            , ;
                    ( OemToAnsi( "STATE:"   ) )                            , ;
                    ( OemToAnsi( "MARRIED:" ) )                            , ;
                    ( OemToAnsi( " - "      ) )                              ;
            FIELDSIZES 150, 150, 250, 250, 90, 90, 01                        ;
            COLOR CLR_BROWN, CLR_LGREEN CURSOR oCurDedo FONT oFont UPDATE    ;
            ID 101 OF oDlg

   //-----------------------------------------------------------------------//
   oLbx:nClrBackHead  := CLR_LGREEN  // Cor do Fundo do Cabe‡alho
   oLbx:nClrText      := {|| nRGB( 165,  42,  42 ) } // Cor do Fundo do Cabe‡alho
   oLbx:nClrBackFocus := CLR_HRED    // Cor do Cursor Em Cima do Ötem
   oLbx:nClrForeFocus := CLR_AMARELO // Cor da letra da barra ativa
   oLbx:nClrForeHead  := CLR_HRED    // Cor nos Headers - Cabe‡alhos
   // Cor no Pano de Fundo da Browse() Listbox-Legal - abaixo o comando
   oLbx:nClrPane      := { || IIF( ( oLbx:cAlias )->( OrdKeyNo() ) %2 == 0, ;
                              CLR_LGREEN, CLR_LGRAY ) }
   oLbx:nColAct       := 2           // Onde o Cursor Vai Iniciar na coluna
   oLbx:nLineStyle    := 3           // Estilo das linhas nos dados da Browse
   oLbx:lCellStyle    := .T.         // Somente pinta a c‚lula em que o cursor esta no momento
   // Justifica o Cabe‡alho: .F. = Esquerda .T. = Centro  
   oLbx:aJustify := { .F., .F., .F., .F., .T., .F., .F. }
   oLbx:lMChange      := .F.         // Desabilita Mousemove - Movimentos do Mouse Congelam.
   oLbx:SetFocus()                   // Refocus on The Browse - Ativa o Foco na ListBox(Browse)
   oLbx:Refresh()                    // Estabiliza o Browse/Listbox - Refresca os Dados.
                                     // Pinta os Dados Novamente
   //-----------------------------------------------------------------------//

   REDEFINE BUTTONBMP oSaida ID 301 OF oDlg RESOURCE "154" TEXTRIGHT         ;
      ACTION ( oDlg:End() ) CANCEL

   oSaida:cTooltip := { "Click no Botão Para Sair",                          ;
                        "Saida - Exit - Cancelar ", 1, CLR_WHITE, CLR_CYAN }

   SET FONT OF oSaida    TO oFont

   ACTIVATE DIALOG oDlg ON INIT CTRLS_COLORS( oDlg )

   oFont:End()
   oFnt:End()
   oFont1:End()
   oFont2:End()
   oFont3:End()

RETURN NIL
// --Fecha o Programa Definitivamente e Libera a Memoria RAM.
FUNCTION CIERRA_TODO()

   IF File( "SILVSLOW.LOG" )
      DELETEFILE( "SILVSLOW.LOG" )
   ENDIF

   oFont:End()
   oFont40:End()

   dbCommitAll()
   dbUnlockAll()
   dbCloseAll()
   FreeResources()
   RELEASE ALL
   SysRefresh()

   hb_gcAll( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   QUIT

RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   LOCAL nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   LOCAL nRow := 0, nCol := 0, n
   LOCAL nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   IF oBmp:hBitmap == 0
      RETURN NIL
   ENDIF

   WHILE nRow < nHeight

      SYSREFRESH()

      nCol = 0

      WHILE nCol < nWidth

         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )

         nCol += nBmpWidth

      END

      nRow += nBmpHeight

   END

RETURN NIL

FUNCTION CAMBIAR_INDICE_SLOW( nOpcRadioEnde, cAlias, oLbx )

   LOCAL oDlg, oFont, oBrw, oSay, DBPESQ, cIndice, oSaida, nRecno, cResName
   LOCAL nKey := VK_ESCAPE, nColuna := 1, nProposta, aGrad, oBmp

   cResName := "LUPA2"

   IF nOpcRadioEnde == 5 //-> Por STATE

      DbSelectArea( cAlias )    
      SET ORDER TO 05

      cIndice := OemToAnsi( "STATE" )

      nColuna := 5

   ELSEIF nOpcRadioEnde == 4 //-> Por CITY

      DbSelectArea( cAlias )    
      SET ORDER TO 04

      cIndice := OemToAnsi( "CITY" )

      nColuna := 4

   ELSEIF nOpcRadioEnde == 3 //-> Por STREET

      DbSelectArea( cAlias )    
      SET ORDER TO 03

      cIndice := OemToAnsi( "STREET" )

      nColuna := 3

   ELSEIF nOpcRadioEnde == 2 //-> Por LAST

      DbSelectArea( cAlias )    
      SET ORDER TO 02

      cIndice := OemToAnsi( "LAST" )

      nColuna := 2

   ELSEIF nOpcRadioEnde == 1 //-> Por FIRST

      DbSelectArea( cAlias )    
      SET ORDER TO 01

      cIndice := "FIRST"

      nColuna := 1

   ENDIF

   GO TOP

   DBPESQ := ALIAS()

   // Master Rao, the "assembly" of xBrowse() is very slow.

   aGrad := { { 0.30, CLR_WHITE, CLR_WHITE },{ 0.50, CLR_WHITE, CLR_WHITE } }

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

   DEFINE DIALOG oDlg SIZE 1000, 500 PIXEL FONT oFont                        ;
      TITLE "FIVEWIN:-> BUSQUEDA INCREMENTAL - Ingresa lo que deseas buscar" ;
      GRADIENT aGrad

   oDlg:lHelpIcon := .F.

   //    FIELD FIRST, LAST, STREET, CITY, STATE
   @ 30, 10 XBROWSE oBrw SIZE -10, -10 PIXEL OF oDlg                         ;
      DATASOURCE "DBPESQ" AUTOCOLS AUTOSORT CELL LINES NOBORDER              ;
      HEADERS "FIRST:", "LAST:", "STREET:", "CITY:", "STATE:"                ;
      FIELDS ( cAlias )->FIRST, ( cAlias )->LAST, ( cAlias )->STREET,        ;
             ( cAlias )->CITY,  ( cAlias )->STATE

   oBrw:cTooltip :={ "Click Para Pegar",                                     ;
                     "DADOS DO CLIENTE", 1, CLR_WHITE, CLR_HBLUE }

   BrwColors( oBrw, .T. )

   WITH OBJECT oBrw

      oBrw:lIncrFilter := .T. // Liga o Filtro incremental
      oBrw:lSeekWild   := .T. // Liga a busca incremental

      oBrw:bKeyDown    := { |nKey| If( nKey == VK_RETURN, ( oDlg:End() ), nil ) }
      oBrw:bKeyChar    := { |nKey| If( nKey == VK_ESCAPE, ( oBrw:Seek( "" ), oDlg:End() ), nil ) }

      // This command makes XBROWSE() extremely slow Mister Nages.
      // oBrw:AutoFit() // Auto ajuste / ajuste automatico do xBrowse()

      :nStretchCol     := STRETCHCOL_WIDEST  // Ajusta as colunas do xBrowse.

      :nColSel := nColuna // <n>  // Mister Nages - Perfect. Cursor inicia na xBrowse()

      oBrw:CreateFromCode()

   END

   @ 10, 055 SAY "Ingresa lo que deseas buscar: " SIZE 120, 10 PIXEL OF oDlg ;
      COLOR METRO_EMERALD, CLR_WHITE TRANSPARENT

   @ 10, 150 SAY oBrw:oSeek PROMPT oBrw:cSeek PICTURE "@!" UPDATE            ;
      OF oDlg PIXEL COLOR METRO_EMERALD, CLR_WHITE FONT oFont SIZE 120, 10 // BORDER

   @ 10, 270 SAY "Buscar Por: "+cIndice + " <Back> Apagar" SIZE 150, 10      ;
      PIXEL OF oDlg COLOR METRO_EMERALD, CLR_WHITE TRANSPARENT

   WITH OBJECT oBrw:oSeek
      oBrw:bLClicked := { || oDlg:End() }
   END

   @ 1.5, 5.5 SAY "<ESC>" SIZE 50, 12 PIXEL OF oDlg COLOR METRO_EMERALD, CLR_WHITE TRANSPARENT

   @ 0.5, 056 BITMAP oBmp RESOURCE cResName SIZE 50, 50 NO BORDER OF oDlg TRANSPARENT

   oBmp:cToolTip := "Pesquisa Incremental Por: " + cIndice

   @ 010, 005 BUTTONBMP oSaida PROMPT( "&Salida" ) ACTION( oDlg:End() )      ;
      RESOURCE "154" TEXTRIGHT SIZE 45, 12 PIXEL FONT oFont OF oDlg CANCEL

   oSaida:cToolTip := "Saida - Exit - Cancelar"

   ACTIVATE DIALOG oDlg CENTERED                                             ;
      ON INIT ( oBrw:cSeek(""), oBrw:SetFocus(), .F. )

   oFont:End()

   CLOSE( DBPESQ )  // CLOSE FILTER - FECHO FILTRO DA XBROWSE()

   // REABRO O BANCO PARA REFRESCAR A LISTBOX ORIGINAL E POSICIONO O CURSOR
   USE SILVSLOW ALIAS SILVSLOW INDEX SILVSLOW NEW SHARED
   SET ORDER TO 01
   GO TOP

   DBSILVSLOW := ALIAS() // SILVSLOW.DBF

   SELECT( DBSILVSLOW )

   oLbx:Refresh()

RETURN NIL
// Cores no xBrowse
STATIC FUNCTION BrwColors( oBrw, lFoot )

   LOCAL cClrBack

   DEFAULT lFoot          := .F.

   oBrw:l2007             := .F.
   oBrw:nRowHeight        := 24
   oBrw:nHeaderHeight     := 24
   oBrw:lFooter           := lFoot

   // oBrw:lRecordSelector     := .F.
   // oBrw:lColDividerComplete := .F.
   // oBrw:lRowDividerComplete := .F.
   
   oBrw:lFlatStyle        := .T.
   oBrw:bClrHeader        := { || { METRO_EMERALD, CLR_WHITE, CLR_WHITE } } //RGB( 232, 255, 232 ), RGB( 232, 255, 232 ) }}
   oBrw:lFullGrid         := .F.

   /*
   // MODIFICADO EN: 14/05/2024 Por: Joao
   // oBrw:nRowDividerStyle  := LINESTYLE_NOLINES //DARKGRAY  //LINESTYLE_LIGHTGRAY      //
   // oBrw:nColDividerStyle  := LINESTYLE_NOLINES //LIGHTGRAY // LINESTYLE_NOLINES

   // oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
   // oBrw:nMarqueeStyle := MARQSTYLE_HIGHLWIN7 // nao gostei
   */


   oBrw:bClrStd = { || If( oBrw:KeyNo() % 2 == 0, ;
      { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_HBLUE ),   ;
           RGB( 198, 255, 198 ) },                                  ;
        { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_HBLUE ), ;
           RGB( 232, 255, 232 ) } ) }

   oBrw:bClrSel = { || { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_WHITE ),;
                           RGB( 34, 177, 76 ) } } //RGB( 0x33, 0x66, 0xCC ) } }
   
   cClrBack = Eval( oBrw:bClrSelFocus )[ 2 ]

   oBrw:bClrSelFocus  := { || { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_WHITE ),;
                              cClrBack } }

   oBrw:SetColor( CLR_HBLUE, RGB( 232, 255, 232 ) )

   oBrw:SetFont( oFont1 )

RETURN NIL
// By Giovanny Vecchi - TESTRAD.PRG aqui na minha pasta.
FUNCTION CTRLS_COLORS( f_oDlgContainer )

   LOCAL lc_aCtrls := {}, lc_iFor := 0
   LOCAL lc_aItemsRadio := {}

   lc_aCtrls := f_oDlgContainer:aControls

   FOR lc_iFor := 1 TO Len( lc_aCtrls )

      IF ValType( lc_aCtrls[lc_iFor] ) == "O"

         IF lc_aCtrls[lc_iFor]:ClassName() == "TRADIO"

            aEval( lc_aCtrls[lc_iFor]:oRadMenu:aItems,                 ;
                   {|_oRadId|{ SetWindowTheme( _oRadId:hWnd, "", "" ), ;
                   _oRadId:SetColor( METRO_EMERALD, CLR_WHITE ) } } )
                   
         ELSEIF lc_aCtrls[lc_iFor]:ClassName() == "TCHECKBOX"

            SetWindowTheme( lc_aCtrls[lc_iFor]:hWnd, "", "" )

            lc_aCtrls[lc_iFor]:SetColor( METRO_EMERALD, CLR_WHITE )

         ENDIF

      ENDIF

   NEXT

RETURN NIL

// FIN / END - kapiabafwh@gmail.com
 


Gracias, TKS.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby karinha » Fri Jun 14, 2024 2:38 pm

Download the full new version here:

Descargue la nueva versión completa aquí:

https://mega.nz/file/ZVFXTBaZ#B9LpoOOjPqd74Q_yR-xL8TDYgRwLb6SIXjytfBNAHfI

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby karinha » Fri Jun 14, 2024 3:29 pm

Mestre Rao, a simple example, is in: c:\fwh\samples\xbrecsel.prg

Mestre Rao, un ejemplo sencillo, está en: c:\fwh\samples\xbrecsel.prg

Code: Select all  Expand view

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

// c:\fwh\samples\xbrecsel.prg

static function Sample3()

   local oDlg, oBrw, oFont

   // USE CUSTOMER NEW SHARED
   USE SILVSLOW NEW SHARED

   SET ORDER TO TAG FIRST
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 860,400 PIXEL TRUEPIXEL ;
      FONT oFont ;
      TITLE FWVERSION + " : PopUp Menu from RecSel"

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE Alias() AUTOCOLS AUTOSORT         ;
      CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw

      :nHeaderHeight    := 60
      :SetChecks()
      // RecordSelector
      :bRecSelData      := { |brw| brw:KeyNo }
      :bRecSelFooter    := { |brw| brw:nLen }
      :bRecSelHeader    := "SlNo"
      :bRecSelClick     := { || RecSelPopUp( oBrw ) }
      :nRecSelWidth     := "9999"
      :SetRecSelBmp( "c:\fwh1905\bitmaps\16x16\fivetech.bmp" )
      :nRecSelHeadBmpNo := { 16, 16, { { "L", 0, 2, 16, 16, 2, 1, 2, 14 }, ;
                                       { "L", 0, 2, 16, 16, 7, 1, 7, 14 }, ;
                                       { "L", 0, 2, 16, 16,12, 1,12, 14 } } }

      //
      // :AutoFit() // terrible de lento.

      :CreateFromCode()
   END

   @ 20,20 SAY 'Click on RecSelHeader for PopUp Menu. Usage: oBrw:bRecSelClick     := { || RecSelPopUp( oBrw ) }' ;
      SIZE oDlg:nWidth - 40, 20 PIXEL OF oDlg CENTER COLOR CLR_RED,oDlg:nClrPane

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

   //CLOSE CUSTOMER
   CLOSE SILVSLOW

return nil
 


Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby Marc Venken » Sun Jun 16, 2024 12:33 pm

Karinha,

I'm a Xbrowse lover ))) but I always try to learn from all posts.

I believe that Xbrowse is not the ulimate speed browse. Mr. Rao also post this now and then. It has tremendos power for the rest, and thats why I love it.

If we do need the best speed in larger databases, that we need to exclude some of the fancy features like Pyjama striping, and Autofit.

Did you test with : oBrw:lFastDraw set to .t. ? I don't see it in the test.

Also very important is the fact of using the best filtering/scoping. There have been some postings about this.
In these postings I noticed that Mr. Rao explaned the speed issues if not using the correct Filter/scope technic that is included in the RDD itself. The explanation is not yet posted. (simple out of the mind)

If i'm correct (Mr. Rao) mayby the explanation off RDD optimasation can be posted here.



// From readme...

(c) Enhancement: AutoFit() can be called at anytime now:
AutoFit( [aColsToFit], [lVisibleOrNumRows], [lDataOnly], [nMaxWidth] )
aColsToFit: Optional array of columns to fit.
Defaults to all columns, if called after Adjust() method
Defaults to only those columns to which nWidth is not expressly
assigned (and EDIT_LISTBOX), if called before Adjust() method.
lVisibleOrnumRows: When .T. is specified during runtime, only visible
rows are adjusted. If a number is specifed, only the first specified
of rows are adjusted.
Default is all rows. This may be slow for large disk based datas sources.
lDataOnly: Default .f. If .t. width is adjusted to fit data only and header
and footer widths are not considered.
nMaxWidth: If specified the width of any column is limited to this maximum.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: problem with big dbf on xbrowse

Postby karinha » Sun Jun 16, 2024 3:11 pm

Good morning Marc. I also love XBROWSE(), and I understand that the AUTOFIT() command is optional. But imagine in a database with 500,000 records, it is impossible for the client to use XBROWSE() with AUTOFIT(). I made the change you indicated, and the slowness continues with a database with 56,000 records.

Buenos días marc. También me encanta XBROWSE() y entiendo que el comando AUTOFIT() es opcional. Pero imagine que en una base de datos con 500.000 registros, es imposible que el cliente utilice XBROWSE() con AUTOFIT(). Hice el cambio que indicaste y continúa la lentitud con una base de datos con 56.000 registros.

Code: Select all  Expand view

   WITH OBJECT oBrw

      :lIncrFilter := .T. // Liga o Filtro incremental
      :lSeekWild   := .T. // Liga a busca incremental

      :bKeyDown    := { |nKey| If( nKey == VK_RETURN, ( oDlg:End() ), nil ) }
      :bKeyChar    := { |nKey| If( nKey == VK_ESCAPE, ( oBrw:Seek( "" ), oDlg:End() ), nil ) }

      :lFastDraw        := .T.

      // This command makes XBROWSE() extremely slow Mister Nages.
      :AutoFit() // Auto ajuste / ajuste automatico do xBrowse()

      :nStretchCol     := STRETCHCOL_WIDEST  // Ajusta as colunas do xBrowse.

      :nColSel := nColuna // <n>  // Mister Nages - Perfect. Cursor inicia na xBrowse()

      :CreateFromCode()

   END
 


Marc, here you have all the SOURCES AND RESOURCES to be able to test the slowness:

Marc, aquí tienes todas las FUENTES Y RECURSOS para poder probar la lentitud:

https://mega.nz/file/ZVFXTBaZ#B9LpoOOjPqd74Q_yR-xL8TDYgRwLb6SIXjytfBNAHfI

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby karinha » Sun Jun 16, 2024 3:18 pm

Marc, cuando uso: :lFastDraw := .T.
sin AUTOFIT(), causa un EFECTO SECUNDARIO en XBROWSE() que no luce bien comercialmente.

Marc, when I use: :lFastDraw := .T.
without AUTOFIT(), it causes a SIDE EFFECT on XBROWSE() that does not look good commercially.

Look:

https://imgur.com/xQbgrBo

Image

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby Marc Venken » Sun Jun 16, 2024 7:42 pm

Karinha,

Please check the EXE, I get a warming from defender.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: problem with big dbf on xbrowse

Postby Marc Venken » Sun Jun 16, 2024 7:59 pm

karinha wrote:
Marc, when I use: :lFastDraw := .T.
without AUTOFIT(), it causes a SIDE EFFECT on XBROWSE() that does not look good commercially.


Could you, just for the sake of testing uncomment ALL items that have to do with the looks ? like

oLbx:nClrPane := { || IIF( ( oLbx:cAlias )->( OrdKeyNo() ) %2 == 0, ;
CLR_LGREEN, CLR_LGRAY ) }

and all others. Just to see if you get more speed and then turn on step by step the others for nice looks.

BTW : I try to get your sample to compile, but then I need to change your bat files and that is not working ok for now. (I never changed these ....)
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: problem with big dbf on xbrowse

Postby Otto » Sun Jun 16, 2024 8:06 pm

Hello Karinha,

Where can I download the DBF? The hosting service you use isn't particularly well-known here. Do you have another option for uploading it?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: problem with big dbf on xbrowse

Postby Silvio.Falconi » Mon Jun 17, 2024 8:37 am

Otto wrote:Hello Karinha,

Where can I download the DBF? The hosting service you use isn't particularly well-known here. Do you have another option for uploading it?

Best regards,
Otto


Dbcre8.prg
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: problem with big dbf on xbrowse

Postby karinha » Mon Jun 17, 2024 2:15 pm

Marc Venken wrote:Karinha,

Please check the EXE, I get a warming from defender.


Good morning Marc, I removed the compression with UPX.exe, it is probably UPX.exe that is generating a FALSE POSITIVE in WINDOWS DEFENDER.

Buenos días Marc, eliminé la compresión con UPX.exe, probablemente sea UPX.exe el que esté generando un FALSO POSITIVO en WINDOWS DEFENDER.

Try again.
Full download here:

https://mega.nz/file/8UEQGbwZ#r4xx1IA_YQ36jA9YUMCeMuqQ4fuTbujDq2nFA-Wni20

Gracias, Tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby karinha » Mon Jun 17, 2024 2:17 pm

Otto wrote:Hello Karinha,

Where can I download the DBF? The hosting service you use isn't particularly well-known here. Do you have another option for uploading it?

Best regards,
Otto


Good morning Otto. Enter an email so I can send you the complete .rar file.

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby karinha » Mon Jun 17, 2024 2:24 pm

Marc,

BTW : I try to get your sample to compile, but then I need to change your bat files and that is not working ok for now. (I never changed these ....)


Write or send an email saying:

FIVEWIN and FOLDER.
BCC32 and FOLDER
XHARBOUR and FOLDER
That I modify CX.BAT and CX.LNK for you. It's too simple.

Escribe o envía un correo electrónico diciendo:

FIVEWIN y CARPETA.
BCC32 y CARPETA
XPUERTO y CARPETA
Que modifico CX.BAT y CX.LNK para ti. Es demasiado simple.

Gracias, tks

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: problem with big dbf on xbrowse

Postby Marc Venken » Mon Jun 17, 2024 2:50 pm

The warning is gone !!

This is from Buildh in the samples :

if "%FWDIR%" == "" set FWDIR=c:\fwharb
if "%HBDIR%" == "" set HBDIR=c:\harbour
set GT=gtgui

ECHO Compiling...

set hdir=%HBDIR%
set hdirl=%hdir%\lib
set fwh=%FWDIR%

if exist c:\bcc7 set bcdir=c:\bcc7
if exist c:\bcc64 set bcdir=c:\bcc64

This is from my program :

HBDIR=c:\harbour
BCDIR=c:\borland\bcc7
FWDIR=c:\fwharb
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: problem with big dbf on xbrowse

Postby karinha » Mon Jun 17, 2024 3:01 pm

Marc, HB.BAT

Code: Select all  Expand view

HB.BAT

@Echo On
Cls
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for Harbour                             xHarbour development power ³Ü
ECHO ³ (c) FiveTech 1993-2023 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

Echo  .
Echo  Aguarde... Compilando os Modulos do Programa... Processamento Demorado
Echo  Gerando o Arquivo ERRO.LOG, em Caso de Duvidas, Consulte-o. Borland C.

Rem Localizacao dos Paths
Set hdir=C:\HARBOUR
Set bcdir=C:\BORLAND\BCC7
Set fwhdir=C:\FWHARB

@If Exist *.Bak            Del *.Bak
@If Exist SILVSLOW.Obj     Del SILVSLOW.Obj
@If Exist *.Log            Del *.Log
@If Exist SILVSLOW.Map     Del SILVSLOW.Map
@If Exist SILVSLOW.PPO     Del SILVSLOW.Ppo
@If Exist SILVSLOW.TDS     Del SILVSLOW.TDS
@If Exist *.Bc             Del *.bc
@If Exist SILVSLOW.C       Del SILVSLOW.C
@If Exist SILVSLOW.HC      Del *.HC
@If Exist TEMPO.LOG        Del TEMPO.LOG

SET STARTTIME=%TIME%

if not exist TEMPO.LOG @echo Compilação FiveWin For xHarbour >> TEMPO.LOG

@echo ------------------------------- >> TEMPO.LOG
@echo Compilação FiveWin For xHarbour >> TEMPO.LOG

If Exist SILVSLOW.Exe Del SILVSLOW.Exe

%hdir%\bin\harbour SILVSLOW /n /m            /i%fwhdir%\include;%hdir%\include;%bcdir%\include /w0 /p > Erro.log 2>  ERROS.LOG

%bcdir%\bin\bcc32 -M -c -v -O2 -eSILVSLOW.exe -I%hdir%\include -I%bcdir%\include SILVSLOW.C          >> Erro.log 2>> ERROS.LOG

If ErrorLevel 1 Type Erro.log | More
If ErrorLevel 1 Goto Exit

rem comentarios...

%bcdir%\bin\BRC32.EXE -R XPLOOK.RC

:ENDCOMPILE

%bcdir%\bin\ilink32 -Gn -aa -Tpe -s @Cx.Lnk

Echo .
IF ERRORLEVEL 1 GOTO LINKERROR
rem Cls
Echo .
Echo * Aplicacao Foi Desenvolvida Com Sucesso
Echo .
Echo * Aguarde um Momento, Compactando Aplicacao, Usando o PEC2.EXE
Echo .
REM C:\PECOMPACT\PEC2 /NB /EMP:Y /TM:Y /CR:Y /MC SILVSLOW.EXE
REM C:\UPX4\UPX.EXE --lzma  SILVSLOW.EXE
Echo .
Echo * Aplicativo Foi Compactado Com Sucesso - Aguarde Execucao.
Echo .
Echo * Aguarde, Executando o Aplicativo, Gerado Com Sucesso Absoluto *

SET ENDTIME=%TIME%
  for /F "tokens=1-4 delims=:.," %%a in ("%STARTTIME%") do (
   set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  )

  for /F "tokens=1-4 delims=:.," %%a in ("%ENDTIME%") do (
   set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
  )

  rem Calculate the elapsed time by subtracting values
  set /A elapsed=end-start
  set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
  if %hh% lss 10 set hh=0%hh%
  if %mm% lss 10 set mm=0%mm%
  if %ss% lss 10 set ss=0%ss%
  if %cc% lss 10 set cc=0%cc%
  set DURATION=%hh%:%mm%:%ss%,%cc%
  echo Data : %date%
  echo Inicio : %STARTTIME%  >> TEMPO.LOG
  echo Fim    : %ENDTIME%    >> TEMPO.LOG
  echo      ---------------  >> TEMPO.LOG
  echo Tempo  : %DURATION%   >> TEMPO.LOG

SILVSLOW
GOTO EXIT

:LINKERROR
PAUSE * Applicacao Nao Foi Desenvolvida Com Sucesso. Veja ERRO.LOG *
GOTO EXIT
Echo .
cls

:EXIT
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests