I have a form with a lot of controls on it (enough that there is a scroll bar on the Panel). There is an UltraGrid that only fits half way on to the viewable area of the screen. When I click a row on the grid the the panel automatically scrolls so that the entire UltraGroupBox that contains the UltraGrid becomes visible on the screen. This is normal since it seem to happen when ever any control gains focus.
The problem is when the page jumps before the click is processed all the way. So if only the top row is visible and I click on it then after than jump the last row in the grid has been selected.
Is there a way to prevent this from happening?
What version are you using, and do you have the latest hotfix? I'm pretty sure that there has been a fix implemented that will prevent the grid from shifting when it is within a ScrollableControl, though I think that the code in the current hotfixes will not address the issue if there are multiple nested ScrollableControls with AutoScroll enabled. Aside from this, the only thing that I can think of is to handle the MouseDown on the grid to see what was clicked and either process it then or store what was clicked for later processing, since it is the Focus call (as you mentioned) that is triggering this within the panel.
-Matt
Thanks for the quick reply.
The version on the assembly is 6.1.20061.28.
Where do I look for hot fixes?
You can get hoftfixes at the My Keys and Downloads section. However, I just looked up the original fix for this issue and it was only addressed in 6.2 and later. Currently I believe that only versions 7.2 and above are supported, so there will be no more hotfixes past what is already available for 6.2. I would suggest downloading a trial for a later version to see if your issue was addressed.
Matt,
I see a similar behavior with the version 9.1 ultragrid. In my grid, if a select the last visible row, the grid jumps and selects that row and the next one.
Is there any way to fix this?
-Neelima.
Sorry to reply to such an old post, but this exact thing is happening to me and it seems to be a bug in 9.1, which I am also using. If you set the Ultra grid properties as follows:
DisplayLayout.Override.CellClickAction: RowSelect
DisplayLayout.Override.SelectTypeRow: ExtendedAutoDrag
DisplayLayout.Override.SelectTypeCell: None
DisplayLayout.Override.SelectTypeCol: None
When you click on a row that's partially visible, that row becomes the active row, but the row below that one becomes selected. With SelectTypeRow set to Extended, the behavior is normal (the row you click on is active and selected). However I do not wish to allow dragging the mouse to select more than one row, only ctrl and shift selection, so I would like to use ExtendedAutoDrag.
It seems to be that on MouseUp, the control is selecting the row that is now under the mouse, which is the row below the one you click on MouseDown (the wrong row, from the user's perspective).
I tried to find a workaround in several ways but was unsuccessful. I couldn't find a way to disable the automatic scrolling (which would be the ideal solution). I also couldn't find a way to cancel the mouse events and handle the row selection myself. If it were somehow possible to use a different SelectTypeRow value (like Extended or SingleAutoDrag) which isn't bugged, that would be ok too. The interaction I want is multiselect by shift/ctrl+click, but not by mouse drag, and always selecting entire rows.
Please I could use some help at this point, nothing I'm trying is working. Thank you.
Well, if the TableLayoutPanel's AutoScroll is false, then it sounds like this is not the same issue that was reported in this thread.
The issue referred to here is that the container that the grid is in scrolls. If you are just referring to the scrolling of the grid itself, then this is perfectly normal. When you click on a row that is partially in view, the grid has to scroll that row into view.
The grid is in tablelayoutpanel, but the autoscroll of that panel is set to false.
Hi Neelima,
Is your grid inside a Scrollable control?