We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Render Style Doesn''t Match "Real" Style

Thread ID:

Created:

Updated:

Platform:

Replies:

24177 Jan 29,2005 01:47 PM Jan 29,2005 02:50 PM Windows Forms 5
loading
Tags: GridControl
Michael Lenaghan
Asked On January 29, 2005 01:47 PM

I''m using 3.0.1.0 as a virtual grid. In QueryCellInfo I set e.Style.BaseStyle depending on the underlying cell. Cells are painting correctly, but every now and then when I go into edit mode on a cell, it has the wrong style. For example, the renderer is set to the read-only style when it''s on a read-write cell. I''ve tried doing things like adding a ForceRefresh option in a MoveTo that might be fired. I''ve also tried calling CurrentCell.ForceRefresh() at certain points. None of that seems to force the renderer to the style of the underlying cell. Any ideas? Am I doing something wrong, or is there a way to work around the problem? Btw, the grid is allowing some keystrokes on read-only cells. The behaviour is strange--the first keystroke disappears after the second is made, and only two keystrokes are allowed. I had to specifically set e.Cancel to true in CurrentCellStartEditing to stop read-only cells from being editable.

Michael Lenaghan
Replied On January 29, 2005 02:06 PM

One more bit of info: grid[ row, col ].BaseStyle is also wrong. So it looks like *that* may be the problem, rather than the renderer. The odd thing is that the cell is drawing correctly. So whenever/however the wrong value is being set, it happens after drawing...

Administrator [Syncfusion]
Replied On January 29, 2005 02:10 PM

Can you reproduce this problem in one of our samples, or can you provide a sample project that shows this problem? That way we should be able to debug the code and spot why things are not working propely. You can send it to support@syncfusion.com and mention this thread in the subject line.

Michael Lenaghan
Replied On January 29, 2005 02:28 PM

Actually, I think I now see what''s happening. When the user changes some non-grid info, I reset the "model" behind the virtual grid. When all of the resetting is complete, I grab the data from the server. In between, the model is marked as invalid and returns default values. The problem is that the CurrentCell style is being set before the new model values are fetched. That means the defaults are being used, and it just so happens that the default style is the read-only one. The correct style gets set if the cell goes into and out of edit mode. Is there some other way to force the current cell to do that? CurrentCell.Refresh() doesn''t seem to do the trick; nor does moving the current cell back to itself. Btw: after the new model values are set the grid is invalidated--and the paiting is, in fact, using the correct style. That makes it look like CurrentCell caches something, rather than simply being a pointer to the underlying cell...?

Michael Lenaghan
Replied On January 29, 2005 02:50 PM

Ok, I have a solution now. After getting the new data, and before calling Invalidate(), I call ResetVolatileData(). I was doing this at an earlier point (and I still have to, since not all changes require getting new values from the server) but I now call it again at this other point. That forces CurrentCell to re-load its cached values--in particular, the style of the current cell. Btw, as I mentioned earlier read-only styles are allowing a few keystrokes, though what happens is quite odd.

Administrator [Syncfusion]
Replied On January 29, 2005 02:50 PM

The currentcell does cache information, especially if it is active. In this case, the state information is moved from the style to the renderer, and it is the renderer that controls the look of the cell while it is active. After retrieving your new data, you might try calling grid.RefreshRange(grid.CurrentCell.RangeInfo, true) to see if that will reflect your new styleinformation.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;