In XE2 Strange painting of NextGrid via OnMouseMove Event
Posted 07 August 2012 - 03:23 AM
Slowly working my way forward from D2007 to XE2 as far as getting my program working properly.
When I run my mouse over the grid the attached image happens. This is new behavior in XE2. Can you suggest what I can do to stop the strange painting behavior?
If I simply delete the reference to DoGridMouseMove in the onmousemove event, then the strange drawing stops. So there is something with this code that is lacking. I did add the RefreshCell at the end, but it made no difference.
I have an NextGrid laying on top of a JvWizard Panel on my MainForm. The NextGrid has an onmousemove event:
//the idea here is to provide a hot tracking effect in the grid.
//Just hot track the main column, i.e. 0th col.
procedure DoGridMouseMove(Grid: TNextGrid; Shift: TShiftState;
X, Y: Integer);
RowNum, ColNum : integer;
Col : TNxCustomColumn;
with Grid do
RowNum := GetRowAtPos(x, y);
//store RowNum for reverting change
if RowNum > -1 then
Cell[0,RowNum].FontStyle := [fsBold];
if Wizard.WizGridRowNum <> RowNum then
if RowExist(Wizard.WizGridRowNum) then
Cell[0,Wizard.WizGridRowNum].FontStyle := ;
Wizard.WizGridRowNum := RowNum;
Posted 07 August 2012 - 03:26 AM
What it shows is the 1st column of the Grid being painted with the Wizard node map elements, which is to the left of the grid.
Posted 07 August 2012 - 03:50 AM
In another NextGrid on the MainForm whenever I click to expand a treed column, on expansion the grid draws using the image from the left half of the MainForm. In this case it is an image of a VirtualStringTree. This fills the first 4-5 columns. It is persistent which makes the grid totally unusable.
Posted 10 August 2012 - 10:40 PM
Also, on expansion of a treed column row will cause a painting which includes other parts of the screen. I added a Repaint in the OnExpand event. Now, it still does the painting wrong, but it lasts a fraction of a second then is painted properly. I notice it does that only on the first time I try to expand the treed column. Afterwards, the opening and closing of a treed row looks correct.
There is still something wrong with the painting process at least on this mainform which admittedly has many controls on it, which may be interfering with the individual controls' painting. (I have a fcProgressBar in a fcStatusBar which is not painted at all. Instead a section of the top menu is painted here--Weird!)
Posted 23 August 2012 - 11:39 PM
The remaining issues I see are repaints in which briefly the column headers are painted where they belong and again in the first couple of rows of the grid. It is very brief and also does not happen all the time.
Posted 01 September 2012 - 07:31 PM
Please sorry for delay, I was no idea what happenings until you say that DoubleBuffered made it. NextGrid don't need DoubleBuffered since I have spend many time to eliminate flickering (on old computers and monitors). But in v6 you will be able to use it too since I have learn new things in WinAPI.
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
BergSoft Facebook page
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users