txbrowse refresh()

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

txbrowse refresh()

Post by Marc Vanzegbroeck »

Hi,

In twbrowse I used obrw:upstable() + obrw:refresh() after adding or deleting a record.
What do I need to do with txbrowse? If I use obrw:refresh(), the browse is not correct refreshed after adding or deleting a record.
obrw:upstable() does not exist in txbrowse.

Thanks
Marc
User avatar
max
Posts: 122
Joined: Fri Jun 30, 2006 2:14 pm
Location: Ancona - Italy

Post by max »

Marc,
i had this problem a few time ago when i start use TXBROWSE.
After the "delete" of one record, I solve the problem moving my .dbf one record below and up with "skip" and "skip -1". Only after this i note that oBRW:refresh() works fine.
Instead, after "append" command i did not have problems. Check your index files too, because their corruption can cause a wrong refresh() after the append command.

Best regards
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Thanks Max,

The skip-1, skip solve the update-problem after deleting a record.
With the appand it didn't work. The index-file is not corrupted. I test it with a database with only about 20 records.

Regards,
Marc
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Marc,

>With the appand it didn't work. The index-file is not corrupted. I test it with a database with only about 20 records.

Should the appended record be visible in the browse (considering the index)? Is there data in the appended record (perhaps it is visible, but there is no data to see)?

Regards,
James
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

James,

The appended record should be visible and is visible. The problem is that after the append it is added in the browse and is selected, but if you scroll up or down the data of those field change to the data that is now there.
Also scrolling up after appending a new record, the browse doesn't go completely up anymore but stops at the top record in the database. And this is not the top op the browse. Scrolling completely down, and than up, the problem is solved.

Regards,
Marc
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Marc,

This is just a guess, but you might try:

eval( oBrw:bBookmark )

after doing the append.

Regards,
James
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

James,

It did't work.

Here is an example. You must press 'ADD' a couple op times and then scroll the browse. You will notice the problem.

Code: Select all

#INCLUDE "FiveWin.ch"
#include "xbrowse.ch"
FUNCTION test()
   local oDlg
   local oCol
   local vgetlist
   local dbstructuur:={}
   aadd(dbstructuur, { 'NAME','C',16,0})
   dbcreate('TEST',dbstructuur)

   use test new EXCLUSIVE
   index on upper(name) tag tmp

   DEFINE DIALOG oDlg RESOURCE "TEST"

   vGetlist := TXBrowse():New( oDlg )

   REDEFINE BUTTON ID 100 OF oDlg ACTION addname(vgetlist)

   oCol := vGetlist:AddCol()
   oCol:bStrData      := { || test->name}
   oCol:cHeader       := 'NAME'
   oCol:nWidth        := 100
   oCol:lAllowSizing  := .f.

   vGetlist:lAllowRowSizing     := .f.
   vGetlist:nRowHeight          := 20
   vGetlist:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
   vGetlist:nColDividerStyle    := LINESTYLE_LIGHTGRAY
   vGetlist:nRowDividerStyle    := LINESTYLE_LIGHTGRAY

   vGetlist:SetRDD()
   vGetlist:CreateFromResource( 101 )

   ACTIVATE DIALOG oDlg CENTERED
RETURN nil

FUNCTION addname(vgetlist)
   appe blank
   repl name with str(HB_RANDOMINT(1,10000) ,5,0)
   vgetlist:refresh()
RETURN nil

Code: Select all

TEST DIALOG 6, -35, 489, 395
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "TXBrowse test"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 101, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 8, 27, 340, 357
 GROUPBOX "Name", 11, 3, 11, 352, 381, BS_GROUPBOX
 PUSHBUTTON "ADD", 100, 377, 25, 92, 19
}
Regards,
Marc
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Antonio,

Did you tried my example?

Thanks,
Marc
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Marc,

I tried your example and I do not see any of the behavior that you describe. I am using FWH 8.08/xHarbour. Perhaps you are using a different version? Maybe you are using a modified xbrowse.prg?

Regards,
James
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Post by anserkk »

Dear Marc & James,

I am using FWH 8.08 and I confirm a refresh problem with the above provided sample.

Try to add more records using the button, you will find that sometimes the xBrowse is not refreshed properly to display whole data, you will need to move thru records either thru mouse scroll wheel or keyboard to view some of the data.

Regards

Anser
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Anser and Marc,

>Try to add more records using the button, you will find that sometimes the xBrowse is not refreshed properly to display whole data, you will need to move thru records either thru mouse scroll wheel or keyboard to view some of the data.

I have retested it and I still do not see a problem. I added 30 or 40 new records and never saw a problem.

What do you mean by the "whole data?"

I am wondering if you mean that sometimes the entire browse window is not filled with data? If this is what you mean, it is not a bug. The currently highlighted record is where the new record will be displayed. Sometimes if the new record is near the end of the file there will not be enough trailing records to fill the browse.

For example, if the currently hightlighted record is the 2nd row in the browse, and you add a new record that becomes the 3rd to the last record in the index, then only 4 records will be displayed (regardless of how many more there are in the file), one record before and two records after.

If you want a full screen of data, then you will have to program this into the append record routine. You will have to figure out how close to the end of the index the new record is, and move to the appropriate record needed to fill the browse. You will also have to figure out which row the new record is, and change the browse pointer to that row (this is oBrw:nAt, I think). And you will have to figure out how to do this if the file doesn't contain enough records to fill the browse. And you have to figure out if neither of the above applies and then do nothing.

Personally, I think the current behavior is acceptable.

Regards,
James
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

James

I use txbrowse intensively in my app and refresh is very buggy when you use keyboard or mousewheel, top line of the browse is displayed often twice.

In the above sample, once you added few records, try to move the keyboard arrow up or mousewheel

i confirm the bad refresh behaviour,

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

What would help is if someone would modify the example so that it added a fixed sequence of numbers so that the same record values are added each time in order. Then you can describe how to recreate the problem step by step, e.g.

"Press the Add button 7 times, then scroll up to the top and one more past the top and you will see..."

A few screenshots would also help.

Otherwise I am having a difficult time seeing what others are saying is wrong.

Regards,
James
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

James,

Here is an AVI-file of the txbrowse problem.

http://www.vms.be/FWTest/txbrowse.avi

Regards,
Marc
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Marc,

I looked at the video and I see the problem, however, I am not able to recreate that here. If you will send me your email address, I will send you my exe and you can see if it works or not there.

Regards,
James
Post Reply