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
875
UltraGrid.EnsureTempActiveRowAssigned()
posted

Is this a bug?

Calling System.Windows.Forms.Form.ShowDialog() fires all way up through UltraGrid.OnPaint() then UltraGrid.EnsureTempActiveRowAssigned() which sets an active row in my grid (which happens to be somewhere in the middle, not even the first row).

I've caught the BeforeRowActivate event to see what's going on.

See the below call stack, thanks.

...WorkersGrid_BeforeRowActivate(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e) Line 498 C#
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.OnBeforeRowActivate(Infragistics.Win.UltraWinGrid.RowEventArgs e) + 0x98 bytes 
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(Infragistics.Win.UltraWinGrid.GridEventIds id, System.EventArgs e) + 0xcbf bytes 
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.OnActiveRowChange(Infragistics.Win.UltraWinGrid.UltraGridRow newActiveRow, bool scrollIntoView) + 0x16c bytes 
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBase.SetActiveRow(Infragistics.Win.UltraWinGrid.UltraGridRow row, bool scrollIntoView) + 0x329 bytes 
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.EnsureTempActiveRowAssigned() + 0x261 bytes 
  Infragistics2.Win.UltraWinGrid.v10.3.dll!Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(System.Windows.Forms.PaintEventArgs pe) + 0x89 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs e, short layer) + 0x9f bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Control.WmPaint(ref System.Windows.Forms.Message m) + 0x757 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x449 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x16c bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m) + 0x11d bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x16c bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m) + 0x11d bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x16c bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref System.Windows.Forms.Message m) + 0x11d bytes 
  System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x15e bytes 
  [Native to Managed Transition] 
  [Managed to Native Transition] 
  System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) + 0x640 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x593 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x81 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner) + 0x765 bytes 

Parents
No Data
Reply
  • 875
    Suggested Answer
    Offline posted

    Having looked at the code for the UltraGrid and UltraGridBase classes, I saw the following in UltraGridBase:

    internal Infragistics.Win.UltraWinGrid.UltraGridRow TempActiveRow
    {
    get
    {
    return this.tempActiveRow;
    }
    set
    {
    // SSP 11/17/04 UWG2234 
    // Changed the behavior so that when a column is sorted we maintain the scroll position
    // instead of keeping the first row the first row. Added SetTempActiveRow method and 
    // moved the code from here into that method. We are passing in true for the 
    // scrollIntoView parameter in order to maintain the previous behavior which was to
    // scroll the row into view.
    //
    this.SetTempActiveRow( valuetrue );
    }
    }
    
    
    I then checked the sort on the first column in my grid, and after a couple of tests, found this to be the reason why. The grid gets loaded up with rows, the sort if then performed on the first column (which happens to be name in this case), the first row in the grid now ends up in the middle of the grid which is still the active row.
    
    
    So in short, it's due to the column sort and the above change.
    If someone could verify my findings, then anyone else who comes across this problem won't have to do the digging that I had to.
Children