Upstable

Upstable

Postby cdmmaui » Thu Jun 19, 2008 4:03 pm

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
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Antonio Linares » Thu Jun 19, 2008 6:43 pm

Darrell,

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

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

Postby nageswaragunupudi » Fri Jun 20, 2008 5:26 am

In xbrowse it is not necessary ( fwh 805 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Fri Jun 20, 2008 9:31 am

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

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

Postby quique » Fri Jun 20, 2008 6:26 pm

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
quique
 
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am

Postby Antonio Linares » Fri Jun 20, 2008 8:54 pm

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: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Fri Jun 20, 2008 9:01 pm

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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby quique » Fri Jun 20, 2008 9:18 pm

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
quique
 
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am

Postby Antonio Linares » Sat Jun 21, 2008 8:24 am

Quique,

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

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

Postby quique » Sat Jun 21, 2008 9:20 pm

Code: Select all  Expand view
#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  Expand view
  // 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  Expand view
   // 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  Expand view
   // 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
quique
 
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am

Postby Antonio Linares » Mon Jun 23, 2008 8:48 am

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  Expand view
#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
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby quique » Mon Jun 23, 2008 6:40 pm

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
User avatar
quique
 
Posts: 408
Joined: Sun Aug 13, 2006 5:38 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests