FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xbrowse autosort
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
xbrowse autosort
Posted: Wed May 29, 2013 04:52 PM
Hello,

I need to set autosort feature later.

I do oBrowse:lAutoSort := .T., but in xbrowse.prg it says as a comment:
// used internally. do not use in applications


Is it safe to use?.

Thank you.
Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse autosort
Posted: Thu May 30, 2013 12:59 AM
Is it safe to use?.

This data is used internally and temporarily till creation of the browse.

Once the browse is created, changing this value has no effect.

For now I have this suggestion:

In the method SetOrder() of TXBrwColumn
Substitute this line at the beginning of the method
Code (fw): Select all Collapse
   if ::cSortOrder != nil

with
Code (fw): Select all Collapse
   if ::oBrw:lAutoSort .and. ::cSortOrder != nil


First create the browse with AUTOSORT clause.
And later toggle oBrw:lAutoSort := .t. or .f. whenever you want.

This feature is being provided in FWH13.05 whether or not the browse is created with AUTOSORT initially.
Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: xbrowse autosort
Posted: Thu May 30, 2013 03:34 AM

Mr Nages,

As I can use incremental seek with tdolphin ?

Thank you.

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse autosort
Posted: Thu May 30, 2013 07:02 AM

Both Incremental Seek and Incremental Filter work with TDolphin.

  1. Incremental Seek ( Works by default )
  2. Incremental WildSeek ( DOES NOT WORK )
  3. Incremental Filter ( Works )
  4. Incremental Wild Filter ( Works )

Incremental seek works by default, if there is a sorted column known to XBrowse. The test is that you should be seeing arrow bitmap on one of the headers.

For incremental filters to work either there should be a sorted column known to xbrowse or you may assign oBrw:cFilterFld, in addition to setting oBrw:lIncrFilter to .t.

Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: xbrowse autosort
Posted: Thu May 30, 2013 03:26 PM

Mr Rao,

You will have a small example of how to use the codeblock: bSeek?

well with in DBFCDX used,
: bSeek = {| c | (oBrw: cAlias​​) -> (DBSEEK (Upper (c). t.))}

Thank you,

Regards,

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse autosort
Posted: Thu May 30, 2013 03:53 PM
albeiroval wrote:Mr Rao,

You will have a small example of how to use the codeblock: bSeek?

well with in DBFCDX used,
: bSeek = {| c | (oBrw: cAlias​​) -> (DBSEEK (Upper (c). t.))}

Thank you,

Regards,


The best and the right way of using XBrowse is NOT to define that code block in your application program. Please remove any definitions of bSeek in your application program if you really want to avail all the powerful features of XBrowse.

XBrowse automatically creates the bSeek codeblock when AUTOSORT clause is used while creating XBrowse. XBrowse creates appropriate codeblocks depending on what we are browsing dbf,ado,array,tdolphin.

Just define XBrowse with AUTOSORT and you are ready with Incremental Seek without any additional Code in the application.

If you want to show what the user types for incremental seek, please add this line of code:

Code (fw): Select all Collapse
@ <row>,<col> SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE <width>, <height> PIXEL OF <oDlg/oWnd> COLOR <your colors>


XBrowse automatically displays what the user types in.

By default, Incremental Seek works if a column is sorted.

if you set oBrw:lSeekWild := .t., the seek is automatically a wild seek. Seeks fpr a row where the column contains anywhere the expression typed.

If you set oBrw:lIncrFilter := .t., browse automatically filters the database and displays only records containing the expression typed.

For a good example, please study \fwh\samples\xbincflt.prg.

Please also remember, to get best results from xbrowse, create with command syntax.
Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: xbrowse autosort
Posted: Thu May 30, 2013 09:08 PM
Mr Rao,

This is the code I'm using with tdolphin,
if I comment the line: bSeek does not work

the field 'cedula' is int (10) and primary key

Code (fw): Select all Collapse
METHOD DataBrowse() CLASS TMyApp
  local oDlg
  local oFont
  local oBar
  local lExit := FALSE
  local oServer:= ::oSrv:oServer
  local oSelf:= Self
   
  ::oQry = oServer:Query( "SELECT * FROM " + ::oSrv:cNomina + " ORDER BY cedula ASC" )
  
  DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12 BOLD
   
  DEFINE DIALOG oDlg RESOURCE "xBrowse" OF oDlg FONT oFont
   
  REDEFINE XBROWSE ::oBrw ID 100 OF oDlg;
    FIELDS ::oQry:cedula, ::oQry:nombre, ::oQry:activo;
    HEADER "Cedula", "Nombre", "Activo" ;
    SIZES  100, 350, 100;
    LINES CELL AUTOSORT
    
  WITH OBJECT ::oBrw:Activo
    :bStrData = {|| if(::oQry:RecCount()>0, if(::oQry:Activo, "Activo", "Inactivo"), ::oQry:activo)}
  END   
        
  WITH OBJECT ::oBrw
    
    :lIncrFilter   := .t.
    // :lSeekWild     := .t.
    
    :nMarqueeStyle:= MARQSTYLE_HIGHLROW 
    :bClrStd := {|| If(::oBrw:KeyNo() % 2 == 0,{CLR_BLACK, RGB( 224, 236, 255 )}, {CLR_BLACK, RGB( 189, 211, 253 )} ) }    
    
    // :bSeek := {|c| DoSeek(c, ::oQry, ::oBrw)}   <==== with this works
    
  END  
  
  REDEFINE SAY ID 101 OF oDlg 
  REDEFINE SAY ::oBrw:oSeek PROMPT ::oBrw:cSeek COLOR CLR_BLACK, nRGB( 117, 236, 45 ) ID 102 OF oDlg
  
  ::oBrw:SetDolphin( ::oQry )
    
  oDlg:oClient = ::oBrw 
   
  ACTIVATE DIALOG oDlg; 
     CENTERED;
     ON INIT ( oSelf:CreaButonBar( oBar, oDlg, @lExit ) )
   
  ::oQry:End()
  
  ::oBrw = Nil

Return Nil

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

static function DoSeek( c, oQry, oBrw )
  oQry:Seek( c, "cedula",,, .T. )
  oBrw:cSeek:= ""
Return .T.


I'll be doing wrong?,

pdta : sorry my english..

thanks,

regards,
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xbrowse autosort
Posted: Thu May 30, 2013 11:44 PM

What is the FWH version you are using?

Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: xbrowse autosort
Posted: Fri May 31, 2013 01:02 AM

Mr Rao,

The version is fwh 13.01

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
Posts: 400
Joined: Tue Oct 16, 2007 05:51 PM
Re: xbrowse autosort
Posted: Sat Jun 01, 2013 03:46 PM

Mr Nages,

Still nothing on the subject?

Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com

Continue the discussion