Hi Support,
We have an issue with UltraPanel which scrolls up automatically while updating records to UltraGrid. We have created a sample project to demonstrate the issue.In the sample we have an UserControl containing UltraGrid which we have loaded inside UltraPanel at runtime. In order to replicate issue click on "ADD NEW" button which will add new record at the end of UltraGrid. Enter the name into name field and click on image button column to update the record. On click of image button application prompts message saying "Data have been saved.". As soon as we close the prompt message the panel scroll up to the top. We want to skip this panel scrolling and keep the last edited cell in view. We have attached sample project here with. Please suggest us workaround to skip the scrolling of UltraPanel.
Hi,
I just wanted to let you know we looked into this and, unfortunately, there's nothing we can do about it.
As I mentioned previously, the AutoScroll functionality in the DotNet framework scrolls a control into view when it gets focus. This makes sense, because if you have a bunch of smaller controls, like Textboxes, inside an AutoScroll control, you want the container to automatically scroll the focused control into view when the user tabs through the controls.
When a grid cell goes into edit mode, it shows a child control (a Textbox in this case) and that TextBox is focused and so it scrolls into view. When you leave the cell, the Textbox goes away and the grid gets the focus and so the AutoScroll control (the UltraPanel in this case) tries to scroll the grid into view.
Normally, this would bring the upper left corner of the grid into view, which you don't want. So since the grid and the editors know this is going to happen, we have code to work around it by temporarily setting the AutoScrollOffset on the grid so that no scrolling occurs.
All of this is working correctly. The problem is that the AutoScroll functionality also performs the same scroll operation under a different circumstance - when you lose focus and then regain it.
In this case, your MessageBox is causing the problem. The MessageBox is shown and takes focus away from the grid. When you close the MessageBox, the form gets reactivated and at this point the panel is doing a refresh and scrolling the grid into view again. This refresh is unneccessary in this case, but unlike the case of a cell exiting edit mode, we have no way to detect it and no way to determine if it's neccessary even if we did.
So you could potentially work around the issue by:
A) not showing a MessageBox
or
B) Setting focus to some control on the form (outside the UltraPanel) before showing the MessageBox.
Neither of these is ideal, though, because even if you take out the MessageBox, you can still get the same behavior by switching to some other app and then back again.
So another possibly approach would be to turn off AutoScroll and then try to just manually handle scrolling the ActiveCell into view as needed. It seems like that might be feasible in this case, since you just have a grid and an ExpandableGroupBox here and not a dozen textboxes that the user could tab through.
As per Mike Saltzman's request, I have logged this behavior internally and asked our Development Team to investigate this further. The work item number for this is 148575. I will be sure to update this forum post with the results of their investigation as soon as it becomes available.
Hi Mike,
Thanks for your suggestion. We have upgraded NetAdvantage from "11.2.20112.2050" to "12.1.20121.2135" version but still UI has the same auto scrolling issue with the UltraPanel. We need to fix this issue as soon as possible so can you please suggest us with any other control that we can use instead of UltraPanel to overcome this problem. The only requirement is that the control should have auto scrolling functionality as we have loaded number of UserControls (i.e.ExpandableGroupBox) one below the other at run-time.
This is caused by the UltraPanel (or Panel) control's AutoScroll functionality. When the cell goes into edit mode, it shows a TextBox control as a child of the grid. The Panel automatically scrolls this TextBox into view - which is not a big deal, because it's already in view.
When the cell exits edit mode, the TextBox goes away and the grid gets the focus. The Panel then scrolls the grid into view - meaning the upper left corner of the grid. So it ends up scrolling to the top.
The grid and the editors have code in them specifically to work around this issue, but it's not working in this case. I'm not entirely sure why, but my guess is that it's because the grid is not directly inside the panel, it's inside a UserControl which is inside the panel. That's just a guess, but you do have several levels of nesting going on here with the ExpandableGroupBox and the UserControl.
I'm going to ask Infragistics Developer Support to write this up as a bug for developer review so we can look into this further. But please be aware that the version of NetAdvantage you are using is no longer being updated. So any fix for this issue would require you to update to a newer version of NetAdvantage.