FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Problemas con xbrowse
Posts: 118
Joined: Fri Dec 20, 2013 10:39 AM
Problemas con xbrowse
Posted: Mon Jan 12, 2015 09:23 AM
Hola. Estoy migrando mis listbox a xbrowse y a la hora de a帽adir o modificar o eliminar la velocidad va bien, pero al usar las propias b煤squedas del xbrowse se vuelve muy lento. Uso 铆ndices NTX que creo as铆:

Code (fw): Select all Collapse
         USE ARTICULO
         PACK
         *****************************************************************************
         CALCULO()
         INDEX ON DESCRIPCIO TO NOMART EVAL {|| ESTADO() } EVERY nVER
         OMETER[2]:Set(0)
         OMETER[2]:cText:="Art铆culos 1"
         oMeter[1]:Set(++nACTUAL[1])
         CALCULO()
         INDEX ON CODIGO TO CODART EVAL {||ESTADO() } EVERY nVER
         OMETER[2]:Set(0)
         OMETER[2]:cText:="Art铆culos 2"
         oMeter[1]:Set(++nACTUAL[1])

         CALCULO()
         INDEX ON EAN TO CODEAN EVAL {||ESTADO() } EVERY nVER
         OMETER[2]:Set(0)
         OMETER[2]:cText:="Art铆culos 3"
         oMeter[1]:Set(++nACTUAL[1])

         CALCULO()
         INDEX ON REFEREN2 TO REF2ART EVAL {||ESTADO() } EVERY nVER
         OMETER[2]:Set(0)
         OMETER[2]:cText:="Art铆culos 4"
         oMeter[1]:Set(++nACTUAL[1])


y luego los uso as铆:

Code (fw): Select all Collapse
         SELECT 1
         USE ARTICULO ALIAS dbART INDEX CODART,NOMART,CODEAN,REF2ART SHARED

         DEFINE WINDOW INICIO_C TITLE "Gesti贸n de Art铆culos"  BORDER SINGLE OF PRIN MDICHILD
         inicio_c:SetSize( 900, 400 )
         
       @ 0, 0 XBROWSE LIS_CLI;    // alias dbART ;                     
               HEADERS  "C贸digo","Descripci贸n","Margen","Stock","Precio","PVP";
               OF INICIO_C;
               LINES  CELL;
               fields DBART->CODIGO,DBART->DESCRIPCIO,DBART->MARGEN,DBART->STOCKFIS,;
                      DBART->PVP,DBART->PVP+DBART->PVP*DBART->NOMIVA/100;
               PIXEL ;
               update SIZE 1024,768; 
               on dblclick edit_ar(.f.);
               AUTOSORT ;
               ON CHANGE ( oMsgRecNo:SetText( "Registro: " + ;
                                                        AllTrim( Str( (  RecNo() ) ) ) + " / " + ;
                                                        AllTrim( Str( (  RecCount() ) ) ) ) )
                                                        
               lis_cli:nMarqueeStyle:= MARQSTYLE_HIGHLROWMS                             
          //AllTrim( Str( RecCount() ) )          
       
  
       
         @ 15,  400  SAY  "Buscando: " pixel SIZE 70,20 of obar_cli
         @ 40,  400  SAY LIS_CLI:oSeek PROMPT LIS_CLI:cSeek PIXEL SIZE 400,20 of obar_cli
         lis_cli:lRecordSelector = .T.


Hay alguna cosa rara que veais antes de empezar o me l铆o a cambiar los NTX por CDX a ver si mejora?

Gracias. Un saludo.
Windows 10 + FWH 20.08 + BCC 7.4 + Harbour 3.2.0 + PSPad 5.0.3
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problemas con xbrowse
Posted: Mon Jan 12, 2015 04:50 PM
// alias dbART ;
Nover omit specifying the alias. This is a must for proper functioning. You need to enclose alias name in quotes.

fields DBART->CODIGO,DBART->DESCRIPCIO,
Please never use FIELDS. Only use COLUMNS.
(We provided FIELDS clause only for very quick migration from WBrowse. But using the fields clause you can not get any special features of XBrowse)

I revised main part of your code. Please follow this in future:

Code (fw): Select all Collapse
   @ 0, 0 XBROWSE LIS_CLI OF INICIO_C ALIAS "dbART" ;                     
          COLUMNS "CODIGO", "DESCRIPCIO", "MARGEN", "STOCKFIS", ;
                  "PVP", "PVP+PVP*NOMIVA/100" ;
          HEADERS "C贸digo","Descripci贸n","Margen","Stock","Precio","PVP";
          AUTOSORT ;
          on dblclick edit_ar(.f.);
          ON CHANGE ( oMsgRecNo:SetText( "Registro: " + ;
                                                 AllTrim( Str( (  RecNo() ) ) ) + " / " + ;
                                                 AllTrim( Str( (  RecCount() ) ) ) ) )
                                                        
   WITH OBJECT lis_cli
      :nMarqueeStyle:= MARQSTYLE_HIGHLROWMS                             
      :CreateFromCode()
   END
              
   Inicio_c:oClient := lis_cli

   inicio_c:bPostEnd := { || DBART->( DBCLOSEAREA() ) }
   
   ACTIVATE WINDOW inicio_c
Regards



G. N. Rao.

Hyderabad, India
Posts: 118
Joined: Fri Dec 20, 2013 10:39 AM
Re: Problemas con xbrowse
Posted: Mon Jan 12, 2015 10:35 PM

Hello. I tried it with the changes you mention me, but this way I browse in all fields of the database rather than just those who want to show appear. How I can do so only leave the columns needed? thx.

Windows 10 + FWH 20.08 + BCC 7.4 + Harbour 3.2.0 + PSPad 5.0.3
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problemas con xbrowse
Posted: Mon Jan 12, 2015 11:00 PM
informaticaeloy wrote:Hello. I tried it with the changes you mention me, but this way I browse in all fields of the database rather than just those who want to show appear. How I can do so only leave the columns needed? thx.


No.
You will not see all fields.
Probably you have not followed my sample "exactly" or you have some extra code in your program.

I suggest you to first try this small program.
Code (fw): Select all Collapse
#include "fivewin.ch"
#include "xbrowse.ch"

function Main()

聽 聽local oWnd

聽 聽DEFINE WINDOW oWnd MDI
聽 聽DEFINE BUTTONBAR oWnd:oBar SIZE 100,32 2007
聽 聽DEFINE BUTTON OF oWnd:oBar PROMPT "XBROWSE" ACTION TestBrowse()

聽 聽ACTIVATE WINDOW oWnd

return nil

static function TestBrowse()

聽 聽local oWnd, oBrw, cAlias

聽 聽cAlias := cGetNewAlias( "CUST" )

聽 聽USE C:\FWH\SAMPLES\CUSTOMER NEW ALIAS ( cAlias ) SHARED

聽 聽DEFINE WINDOW oWnd MDICHILD OF WndMain()

聽 聽@ 0,0 XBROWSE oBrw OF oWnd ALIAS cAlias ;
聽 聽 聽 COLUMNS "FIRST", "CITY", "SALARY" ;
聽 聽 聽 CELL LINES NOBORDER

聽 聽oBrw:CreateFromCode()
聽 聽oWnd:oClient := oBrw

聽 聽oWnd:bPostEnd := { || ( cAlias )->( DBCLOSEAREA() ) }

聽 聽ACTIVATE WINDOW oWnd

return nil

If FWH is not installed in your c:\fwh, then please change "C:\FWH\SAMPLES\CUSTOMER" to the path your FWH is installed. Please do not make any other change to this program. Also do not add any extra code to this program.

If you execute this program, you will see only 3 columns FIRST, CITY and SALARY in the browse.
Once you finish the test, we shall add all other features you want.
Regards



G. N. Rao.

Hyderabad, India
Posts: 118
Joined: Fri Dec 20, 2013 10:39 AM
Re: Problemas con xbrowse
Posted: Tue Jan 13, 2015 12:52 AM
Well. I found the problem:
If you define the xbrowse as this:

Code (fw): Select all Collapse
 @ 0, 0 XBROWSE LIS_CLI OF INICIO_C alias dbART ;                     
               HEADERS  "C贸digo","Descripci贸n","Margen","Stock","Precio","PVP";
               LINES  CELL;  
....

It show all the fileds of the database

If you define the xbrowse as this:

Code (fw): Select all Collapse
 @ 0, 0 XBROWSE LIS_CLI OF INICIO_C alias "dbART" ;                     
               HEADERS  "C贸digo","Descripci贸n","Margen","Stock","Precio","PVP";
               LINES  CELL;  
....

It show only the fileds that you asign in the data headers.

The difference is the quotes in the data ALIAS

Thanks you very much nageswaragunupudi

Best regards!!!
Windows 10 + FWH 20.08 + BCC 7.4 + Harbour 3.2.0 + PSPad 5.0.3

Continue the discussion