FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse Refreshing
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM

xBrowse Refreshing

Posted: Fri Sep 30, 2011 09: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: xBrowse Refreshing

Posted: 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
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM

Re: xBrowse Refreshing

Posted: Fri Sep 30, 2011 10:37 AM

That works perfectly

Thanks for your time

best regards,

Pete

Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM

Re: xBrowse Refreshing

Posted: Fri Sep 30, 2011 01:20 PM

please rao, can put a example.

Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM

Re: xBrowse Refreshing

Posted: Fri Sep 30, 2011 01: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

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM

Re: xBrowse Refreshing

Posted: Fri Sep 30, 2011 01:32 PM
This is my code:

Code (fw): Select all Collapse
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()
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM

Re: xBrowse Refreshing

Posted: Fri Sep 30, 2011 01: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

Continue the discussion