Upstable

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Upstable

Post by cdmmaui »

Hello,

Is oLbx:Upstable() still required for FWH 8.01? It seems the REDEFINE LISTBOX is not refreshing properly with oLbx:Upstable, oLbx:Refresh().

Thank You,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Darrell,

Yes, Upstable() should be used in the same way was before
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

In xbrowse it is not necessary ( fwh 805 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Right. It is only needed for TWBrowse and TCBrowse, not for TXBrowse.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
quique
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am
Contact:

Post by quique »

Antonio

Yes it's necesary, I use FWH 8.05 refresh() or refresh(.t.) don't work like upstable(). Or how I can substituting this method?

I sended you at may 22 an email with the modifications that include this method, and it include to can use hash like array in xbrowse between others details, but with this answer I suppose you don't include this changes in next version
Saludos
Quique
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Quique,

We got your email, thanks. We are reviewing your proposed Upstable() implementation and other features, thanks

We will include them in next build :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Quique,

ok, the problem that we find in your code is this line:

local lMatriz := ::nDataType in { DATATYPE_ARRAY, DATATYPE_HASH }

it is not supported by Harbour :-( so we need to find a way to make it compatible

Have you tested your proposed changes with Harbour too ? thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
quique
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am
Contact:

Post by quique »

Thanks you Antonio, and I'm sorry, this var is only trash of my own class when copy to xbrowse, but I think you only delete it.

I found other bug in defaultl parameters, if you are considering that point too, the line

oBrw:lDesign := lDesign

change for

oBrw:lDesign := !empty( lDesign )
Saludos
Quique
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Quique,

Could you please provide an example for xbrowse where Upstable() is required ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
quique
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am
Contact:

Post by quique »

Code: Select all

#INCLUDE "xbrowse.CH"
   local a:= { {"1"}, {"2"}, {"3"}}
   local oWnd, oBrw
   define window oWnd
   @0,0 xbrowse oBrw array a autocols of oWnd
   oBrw:createFromCode()

Code: Select all

  // Muestra solamente 2 registros y se coloca en el registro correcto
   activate window oWnd on init ( eval( oBrw:bBookMark, 2 ), oBrw:refresh() )

Code: Select all

   // Muestra todos los registros pero se coloca en el primero
   activate window oWnd on init ( eval( oBrw:bBookMark, 2 ), oBrw:refresh(.t.) )

Code: Select all

   // Muestra todos los registros y se coloca en el correcto
   activate window oWnd on init ( eval( oBrw:bBookMark, 2 ), oBrw:upstable(), oBrw:refresh() )
Inclusive, el upstable que te envié, a difrencia del de tWBrowse también tiene efecto cuando se trata de los últimos registros de la tabla
Saludos
Quique
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Quique,

The behaviour of xbrowse seems to be correct. When you already position the record pointer on some record ( in this case 2nd array row ) and invoke any browse, that record is shown at the top of the browse.

For example, if you are already on 100th record in a dbf table and invoke xbrowse or any browse, the selected record is shown as the first row in the browse.

If you want to display from 1st array row onwards and position the browse row on the second row, use SetPos( nRow, nCol ) method.

i.e. ACTIVATE WINDOW oWnd ON INIT oBrw:SetPos( 2, 1 )

Now the array will be shown from the first row onwards and the browse cursor will be positioned on the second visible row,

The purpose of Upstable method in the earlier browses was different. If the browse cursor is on n'th row and consequent on chaging index order or modifiying an indexed column the new physical position of the record in the index order is less than 'n', the browse cursor has to be moved upwards to the selected record. Earlier browses needed the upstable method for that. Now xbrowse's refesh method does it automatically.

As an example try this code:

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"

request DBFCDX

function main()

   field NCOL, CCOL

   local n, oWnd, oBrw

   DbCreate( 'xtest', { { 'NCOL', 'N', 3, 0 }, { 'CCOL', 'C', 3, 0 } } )
   USE XTEST VIA "DBFCDX"
   for n = 1 to 5
      DbAppend()
      FieldPut( 1, n )
      FieldPut( 2, Replicate( Chr( 70 - n ), 3 ) )
   next n

   INDEX ON NCOL TAG NCOL
   INDEX ON CCOL TAG CCOL

   USE
   USE XTEST VIA "DBFCDX"
   SET ORDER TO TAG NCOL
   GO TOP

   DEFINE WINDOW oWnd
   @ 0,0 XBROWSE oBrw OF oWnd ALIAS 'XTEST' AUTOCOLS AUTOSORT

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw
   ACTIVATE WINDOW oWnd

return nil
Navigate to 4th or 5th row and change the order.
You will find the browse cursor going up to the correct row: Upstable's functionality is built into TXBrowse
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
quique
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am
Contact:

Post by quique »

I ever use upstable in the form I comment you but with DBFs, this whas a little sample, and with dbf works equal, I use the sample for second row, but it was a sample, I use upstable when add records and I don't know if are meny or few records, or where is the pointer, so, I have seen some posts speak of the same theme, I think I aren't the only person who thinks that
Saludos
Quique
Post Reply