Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Grid and View problem Collapse All
Subject Author Date
Offer Har Jan 9, 2008 - 1:04 PM

Dear Support,

I have a CView derived class and a bar with a grid next to it.
When the user moves the mouse in the view, I redraw the view and update the grid.
The way I redraw the view is by calling InvalidateRect(NULL, FALSE), which trigger the OnDraw which does the actual drawing.
The way I update the grid is by calling OnSwDoRedraw after updating all cells’ value that were changed.

The problem is that if I call OnSwDoRedraw OnDraw is not reached (If i do not call OnSwDoRedraw the OnDraw is reached).

Is there a lighter way to refresh the grid? I know that I only change the content of one or two cells.
Is there a bug in the OnSwDoRedraw?
Is there a way to bypass this problem?

Thanks,
Ron.

Offer Har Jan 23, 2008 - 8:20 AM

Dear Support,

Still waiting for some support on this matter - the problem is clearly related to the grid occupying the CPU too much, not letting the view draw itself.

Ron.

Technical Support Jan 11, 2008 - 7:55 AM

The OnSwDoRedraw() simply invokes CWnd::Invalidate() and CWnd::UpdateWindow(). This method cannot affect re-painting of any other windows outside the grid window. So, the problem hides somewhere else.

Offer Har Jan 11, 2008 - 8:25 AM

Dear Support,

As I mentioned before - the problem is that even though this is a grid with 2-20 rows and 7 columns, the redraw of it consumes the CPU in such way that the OnDraw of my view is not getting called.

This was not the case in the old grid we had, in which we could ask to redraw only a certain cell, as we know exactly what cell is changed, and that way the CPU was not occupied all the time with repainting the grid.

I am asking if there is any way to redraw only a portion of the grid, so that it will not block the whole CPU in each cell update.

Technical Support Jan 10, 2008 - 11:50 AM

The CExtGridWnd window does not affect repainting of windows outside it. There is only one case possible when the grid window does not allow repainting of the view window: if the grid window completely covers the client area of the view window, i.e. the view window is not visible on the screen. Please also note that the CWnd::InvalidateRect() performs delayed repainting when the OnSwDoRedraw() method does repainting with immediate feedback on the screen (same as CWnd::UpdateWindow() invoking immediately after CWnd::InvalidateRect()). We suppose there must be something heavy and based on timers in your application what makes view window repainting delayed for too much time.


Offer Har Jan 10, 2008 - 1:17 PM


My problem is that if I remove the call to OnSwDoRedraw everything works fine... so, I am left with one conclusion - that the call to OnSwDoRedraw prevents the OnDraw from being called.

My grid does not cover the whole view, but it is on top of the view when the bar is floating.

Is there anyway to make sure that the grid draws a certain cell without blocking the whole UI for such a long time that the OnDraw is not called?
In other grids we use there is a way to instruct the grid to draw only one cell, that way it does not block the UI from doing its other tasks.