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.

Virtual grid problem, any way around this?

Thread ID:

Created:

Updated:

Platform:

Replies:

12033 Mar 19,2004 10:07 AM Mar 19,2004 11:59 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 19, 2004 10:07 AM

I have a virtual grid that only displays static cells. I notice that when I even mouse around other controls on my form (not the grid itself) that QueryCellInfo gets called. This seems very wastefull. If I am not modifying the style of my grid cells unless the data is either modified or an actual selection is made, then why should I be paying for the cost of querying for the data when a mouse is hovering on the form itself or a neighboring control?

Administrator [Syncfusion]
Replied On March 19, 2004 10:34 AM

Here is sample that displays the tick count and changes color in any cell when QueryCellInfo is called for that cell. So, it is easy to see when QueryCellInfo is hit. I put other controls on the form and do not see the behavior you described. What are you doing differently? form12033_9369.zip

Administrator [Syncfusion]
Replied On March 19, 2004 10:46 AM

Hmm, I see what you mean. I''ll take a look at mine again and see what''s going on. This leads me to ask though, since I don''t plan on changing the cell''s values or styles unless an actual click on a cell or update on the data is performed, is there anyway to prevent the grid from firing QueryCellInfo on plain mouse movements? I am paying for the cost of getting the data from my models when absolutely nothing is changing on the grid.

Administrator [Syncfusion]
Replied On March 19, 2004 10:57 AM

There is really no way for you to control this behavior. QueryCellInfo tries to cache weak references to styles that are only refreshed when needed. Now, a garbage collection cycle will clear this cache, so any GC would cause QueryCellInfo to fire (the next time the cell is needed for some reason like a mousemove). So, in the sample, even if I move teh nouse over the grid, I dont see teh cells changing. If I start scrolling or clciking then I see values changing. Now if you do the same work in PrepareViewStyleInfo, there is no cache, an dthat event is fired with every mouse move, etc.

Administrator [Syncfusion]
Replied On March 19, 2004 11:29 AM

So in other words there''s no way to really know if QueryCellInfo is being called because the style object was tossed and therefore really needs the data to be set. Which means many times I may be fetching the data and setting it in the style object when its not really needed? And if I understand there''s no good way around that?

Administrator [Syncfusion]
Replied On March 19, 2004 11:59 AM

" may be fetching the data and setting it in the style object when its not really needed?" No. QueryCellInfo is only fired when something in the grid is requesting the style. If the grid is sitting on the desktop with nothing happening, QueryCellInfo would not be fired. But if you move the mouse over the grid, QueryCellInfo may or may not be fired depending upon whether the requested value is still in the volatile cache. But if you drag another window over the grid so the grid is forced to repaint, then QueryCellInfo will be hit for sure. If getting the values from your virtual datasource is too time consuming, then you might consider some caching scheme where you efficiently load a cache of data into some quick lookup structure, and use this structure to feed QueryCellInfo.

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.

;