Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double Buffering for highly liquid controls.

Status
Not open for further replies.

HarleyQuinn

Programmer
Jan 15, 2003
4,769
GB
Hi,

I'm writing a usercontrol that uses the TrueDBGrid8.0.

The grid's DataMode is Storage and it's populated by an XarrayDB object (which in turn is populated from formatted real-time data)

Everything is fine up to here, data received, formatted and displayed. Then it goes a bit off track.

The usercontrol is basically a custom stock ticker and and by nature can receive updates up to anything around 10 times a second. The data populates in the array fine, but the only way to get the data in the grid is to rebind it and that's not a graphically nice operation.

During it the grid can flicker quite heavily (especially on highlighted cells/rows) and on occasion the scroll bars would be bordering requiring an epilepsy warning.

I'll cut to the crunch, obviously this isn't acceptable. I'm looking for a way to double buffer the control so that I avoid the flickering. I've double buffered images but just can't seem to get my head round doing it with controls. I've lloked all over and not been able to find anything in relation to this (well nothing that I found useful) [banghead]

I've also tried using SendMessage() to disable/re-enable the redraw of the grid and while there was a tiny difference there was nothing to write home about. Also please don't suggest LockWindowUpdate() as the affect that can have on the other windows/desktop in something this liquid is bordering on farcical [wink]

Thanks in advance

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Cheers strongm.

That's what I was using with SendMessage() but there was little difference (and I managed to freeze my grid a few times).

I can imagine I'll have been using it incorrectly, you don't happen to have a sample do you?

Cheers

P.S. Yes, I feel like one of those posters that want to to do no research and have an example handed to them (I've been trying to sort this out for ages, I honestly don't though, anything about correct usage in this sort of situation would go a long way if possible [wink]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Wait a minute; doesn't the TrueDBGrid control have a redraw property? DOes that not help?
 
I'm not sure if it's a version specific property but I'd not been able to find it in the version I'm using (8.0).

It certainly would have been useful to have that in there [smile]

I've got it pretty close now after playing about with SendMessage in conjunction the visible property of the grid.

Thanks for taking the time to look at this strongm.

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Are you rebinding the grid after every array line change, or are you waiting until the array has totally reloaded (or the data has totally reloaded int o the array) and then grd.rebind?

I have been using trueGrid in storage mode for years without the issue you discribe unless I rebind a line at a time.

example

for i = 1 to data1.upperbound(1)
data1(i,2) = "something"
grd1.rebind
next i

the above can flicker madly where

for i for i = 1 to data1.upperbound(1)
data1(i,2) = "something"
next i
grd1.rebind

The above will not flicker (under normal situations).

If necessary can you use

grd1.visible = false
grd1.rebind
grd1.visible = true

However, sometimes grd does not like to bind if not visible in which case you could cover it with a splash picture instead

picture1.visible = true
grd1.rebind
picture1.visible = false
 
Cheers yacyac,

I'm rebinding the grid after the array is fully constructed, the problem seems to come with the fact that the array values are changing between 1 (no real flicker) and 10 (quite a bit if flicker until above fix was implemented) times a second therefore the rebind happens at the same intervals. I can only assume that this scenarion falls outside of normal circumstances?

I've used a variation of the visible, rebind, visible example you posted but flanked it with SendMessage using the Setredraw windows message to stop the grid from disappearing and reappearing (which to the client is construed as a flicker).

Just out of interest, seems you've been using it for a while, have you ever had problems with either the cell(0,0) flickering or the currently selected cell (and if not a flicker, the data not showing in those particular cells, though it is populated in the grid)? This is a problem that's really working my old grey matter at the moment [banghead]

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
I have not had an issue with a cell flickering, but I have had the problem with the data in the cell not being visible. This would happen after you had either clicked on the cell or left a cell. The cause ends up being the hieght of the row is too small. Even though the data will appear there initially, once the cell is entered or exited it could disappear.

Another issue you could have - if the size of the array changes (in the number of rows), if you increase the number of rows in the array, the grid may not rebind to it. If seems if you first to the following

data1.redim 1,1,0,xx
grd1.rebind

where xx is the actual number of columns
Then the grid would always repopulate properly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top