Upstable
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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
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
Quique
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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 )
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
Quique
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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() )
Saludos
Quique
Quique
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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:
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
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
You will find the browse cursor going up to the correct row: Upstable's functionality is built into TXBrowse
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
Quique