Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
365
How to stop grid scrolling - or better - to tell form to position to bottom of current grid - not bottom of current row on form.
posted

Currently - selecting a cell in the Grid scrolls the entire page/form to position current row's cursor on the bottom line of screen.

The form in question has many 'yes/no radio buttons followed by grid' sets, enabling the user to select yes, then TAB into the grid and add a row. (The event on the grid to support TAB-ing is included below). The user can TAB from the prior radio button, into the first cell, then after last cell in a grid, to the next radio button following grid, click yes if appropriate and do the same actions on this grid. This works great.

The problem occurs when tabbing into a grid on the bottom of the page, or even click an existing row.  The bottom grid, partially out of view must trigger something in your controls that repositions the parent form to try and set the control's Active Row (which should be the entire Grid) - into focus??

This makes the page extremely difficult to use if there is content present in these rows. If you reverse tab - or even repeatedly click between the two cells on a row and the form re-positions to the bottom the row you are clicking - till any rows that were visible (i.e. 3 valid rows that were visible below current row) - no longer are.

How it should work - Given the grid has a FIXED height of 1/6th the form height (You can view 6 radio-button/grid sets always on the screen) - If I TAB into one that is partially off the form - the form should scroll the entire grid a set height above the bottom of the form - that would show the entire grid and maintain a 'minimum' margin.  Entering new rows would/should make no difference to the position of the grid - as the grid itself has its own scroll bars and its content moves up the row's height - the FORM should stays where it is when a new row is added.
I believe this is possible - but need an 'expert' to tell me how to do this...

I tried: Infragistics.Win.Utilities.FocusControlWithoutScrollingIntoView(grid);
in the BeforeGridRowDeactivate event (since TAB is used primarily to move through grid, OnMouseDown/Up didn't seem appropriate) - with no affect.

Can you tell me what code to use to - maybe another OnEnter event item that scrolls the grid entirely into view - and something to completely disable form autoscroll on this entire form - or fix the auto-scroll to scroll parent-container(grid) into view - and not the control (row) itself.  I think I have the right ideas - but have only been using 11.2 for a couple months... Really could use some help.

Thank you,
Todd

Here is the TAB handler I added just in case you want to know how I did it (since older examples on the Forum did not work - and of course I wonder if you think my method is correct: add template row if not present, set focus to the first 'IsTabStop' cell - which to me implies if it is tabbable, it is visible, then set Edit mode as one of the TAB examples showed).  This does work - so posted here mainly FYI...

public static void OnGridEnter(object sender, EventArgs e)
{

 // Select first cell

UltraGrid
grid = (UltraGrid)sender;
try {
 // Select first cell in grid - Is there any rows in grid

if (grid.Rows.Count == 0)
{
   // No - activate a new row based on template
   grid.Rows.TemplateAddRow.Activate();
}
// Set the first tab into-able cell as the current active cell
for (int i = 0; i < grid.ActiveRow.Cells.Count; i++)
{
  if (grid.ActiveRow.Cells[i].IsTabStop)
  {
     grid.ActiveCell = grid.ActiveRow.Cells[0];
    
break;
  }
}
// Place into edit mode
grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false);
}
catch
{ }
}