xBrowse Refreshing

xBrowse Refreshing

Postby PeterHarmes » Fri Sep 30, 2011 9:45 am

Hi,

I have an xbrowse looking at records in a database. This database can be viewed and edited by multiple users.

If a record is deleted by another user the browse can look corrupt containing duplicate records.

The way i'm trying to fix this is to refresh the browse after i perform any actions within the browse, something like this:

Save current record number
Perform action
Recreate scope & filter
Goto saved record number
Refresh browse

This works ok, but the selected record is positioned at the top of the browse. Is there any way that i can remember the position of the highlight bar, refresh and return the highlight bar to its original position?

I have tried using oBrw:nRowSel but havent had much luck

Any ideas?

Best regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: xBrowse Refreshing

Postby nageswaragunupudi » Fri Sep 30, 2011 10:21 am

I have tried using oBrw:nRowSel but havent had much luck

This is the right way.
Save and restore oBrw:nRowSel and call Refresh()
Regards

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

Re: xBrowse Refreshing

Postby PeterHarmes » Fri Sep 30, 2011 10:37 am

That works perfectly

Thanks for your time

best regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: xBrowse Refreshing

Postby carlos vargas » Fri Sep 30, 2011 1:20 pm

please rao, can put a example.
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1720
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: xBrowse Refreshing

Postby Rick Lipkin » Fri Sep 30, 2011 1:31 pm

Peter and Rao

I have been fighting this very same problem only instead of using .dbf I have been using recordsets.

I set up a test where I had the same app open twice and the first app deleted a row and I tried to trap the second app from trying to delete the same row since to app 2 his recordset still had the 'deleted' record buffered and displayed.

What I did was in the delete routine .. I stored the unique row id of the record to be deleted .. did a oRs:Requery() to refresh the 'current' data .. did a oRs:Find on the ( row id and if oRs:eof ( or not found ) .. showed an alert the row was missing and issued a oBrw:Refresh().

Where I got into trouble was issuing both oBrw:Refresh() and a SysRefresh() and I got all kinds of run time errors. By accident .. I removed the SysReFresh() and xBrowse re-painted correctly eliminating the previously deleted row.

Like Rao mentions .. just issue a oBrw:ReFresh() and xBrowse will re-adjust and display the current records ( added, edited or deleted ) properly.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: xBrowse Refreshing

Postby PeterHarmes » Fri Sep 30, 2011 1:32 pm

This is my code:

Code: Select all  Expand view


nSavRec := ORDERS->(Recno())
nSavRow := oBrw:nRowSel
//Apply Scope and filter
SetSchedFilter(.T.)
ORDERS->(DbGoto( nSavRec ))
IF ORDERS->OR_TICKNBR > 0   //Record Exists
    oBrw:nRowSel := nSavRow 
ELSE
    oBrw:Gotop()
ENDIF
oBrw:Refresh()
 
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: xBrowse Refreshing

Postby PeterHarmes » Fri Sep 30, 2011 1:42 pm

Rick,

My problem was due to a SysRefresh() being in my browse refresh routine.

The only problem I have now is if a record is deleted on another machine and the user scrolls up using the up/down arrow when it comes to the deleted record, a duplicate row appears - page up/page down refreshes as well as my refresh routine.

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 92 guests