FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour xBrowse, bSeek y lAutoOrder
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
xBrowse, bSeek y lAutoOrder
Posted: Fri Jun 28, 2013 02:32 PM
Hola foro,
esta mana帽ana estaba intentando reutilizar una porci贸n de c贸digo que funcionaba originalmente con FWH 12.11, y al incorporarla al nuevo proyecto desarrollado con FWH 13.05, ha dejado de funcionar.
Inicialmente, pense que era alg煤n problema con el c贸digo, y despues de revisarlo detenidamente y no encontrar nada, me decidi a rastrear la calse xBrowse, y all铆 encontre el problema.
El problema es que en mi funci铆on hago uso de una busqueda incremental personalizada, que asigo al DATA bSeek, pero este DATA se sobreescribe siempre en el metodo SetRdd, que se llama siempre desde el metodo initiate. Antes habia un if, que hoy aparece comentado, en la linea 3979.
Code (fw): Select all Collapse
// 聽 if lAutoOrder

聽 聽 聽 (::cAlias)->( OrderTagInfo( aStruct, 8 ) )

聽 聽 聽 for nFor := 1 to Len( ::aCols )
聽 聽 聽 聽 聽if ( n := AScan( aStruct, { |a| a[ 1 ] == Upper( ::aCols[ nFor ]:cHeader ) } ) ) > 0
聽 聽 聽 聽 聽 聽 ::aCols[ nFor ]:cSortOrder 聽 聽:= aStruct[ n ][ 8 ]
聽 聽 聽 聽 聽 聽 ::aCols[ nFor ]:cOrdBag 聽 聽 聽 := ( cAlias )->( OrdBagName( ::aCols[ nFor ]:cSortOrder ) )
聽 聽 聽 聽 聽endif
聽 聽 聽 next nFor

聽 聽 聽 ::bSeek 聽:= { |c,u| ( ::cAlias )->( ::RddIncrSeek( c, @u ) ) }

// 聽 endif

Si lAutorder era falso, bSeek no era modificado. Mi pregunta es, ese cambio, supongo que ser谩 para arreglar/mejorar algo, quisiera conocer que. Y en la medida de lo posible para compatibilizar mi software, me gustaria que volviera el IF lAutoOrder, o en us defecto que no se modificase bSeek, si ya est谩 asignado.
Code (fw): Select all Collapse
DEFAULT ::bSeek 聽:= { |c,u| ( ::cAlias )->( ::RddIncrSeek( c, @u ) ) }
Saludos desde Mallorca
Biel Maim贸
http://bielsys.blogspot.com/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse, bSeek y lAutoOrder
Posted: Mon Jul 01, 2013 07:05 AM

It is highly desirable to first call

oBrw:cAlias := <youralias>
oBrw:SetRdd( .... )

before assigning any of your data and codeblocks.

If you do not explicitly call SetRdd( .. ) initially in the program, XBrowse at the time of initializing by default calls SetRdd(), but this is not recommended.

As you suggested, we are now creating ::bSeek in SetRDD method as DEFAULT (from version 13.06) to take care of above situations.

Still our advice is to use command syntax to create xbrowse to avail the full power of xbrowse.

Regards



G. N. Rao.

Hyderabad, India
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Re: xBrowse, bSeek y lAutoOrder
Posted: Mon Jul 01, 2013 09:23 AM

Hi, many thanks for your answer.
Thanks for your recommendation to use SetRDD before assigning DATA or codeblocks, that solves the problem due after executing SetRDD I can change the codeblocks, and Initiate will not run again SetRdd.

After reviewing the xBrowse class, another alternative is to define the DATA :nDataType :=DATATYPE_RDD.

I know the command syntax is easy, fast and powerful. But I feel confortable woorking at object level, gives me more control of what I do and how I want to do it.

Saludos desde Mallorca
Biel Maim贸
http://bielsys.blogspot.com/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse, bSeek y lAutoOrder
Posted: Mon Jul 01, 2013 12:31 PM
Thanks for your recommendation to use SetRDD before assigning DATA or codeblocks, that solves the problem due after executing SetRDD I can change the codeblocks, and Initiate will not run again SetRdd.


That is how XBrowse is intended to be used. Any further developments assume xbrowse is used the way it is intended to be used.

XBrowse has some fault tolerant coding. Instead of failing the programmer, it tries to accommodate programmer's deviations from the intended usage by providing intelligent defaults.

Calling SetRdd() by default during Initialization is provided as one of such features in case the programmer forgot the explicitly call this method initially.
But it is not desirable for th programmer to rely on such defaults because it is always safe to be explicit and not to rely on defaults.

After reviewing the xBrowse class, another alternative is to define the DATA :nDataType :=DATATYPE_RDD.

This may work. But still I advise you to go the recommended way.

I know the command syntax is easy, fast and powerful. But I feel comfortable working at object level, gives me more control of what I do and how I want to do it.


You have the choice of style of programming. Still it is my duty to recommend using command syntax for creation of xbrowse and if not you may be missing out the full power of xbrowse. Final choice is yours.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion