Main Site Documentation

DataGrid causes and exception when clicked on


#1

I have a DataGrid and I get an exception when I click on it. The exception only happens when I click on the DataGrid and it pauses within the touch driver at the TouchUp, all other Glide components seem OK.

This is the line it breaks at:


GlideTouch.RaiseTouchUpEvent(null, new TouchEventArgs(touches));

This is in the debug window.


Uncaught exception 
    #### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (3) ####
    #### Message: 
    #### System.Collections.ArrayList::get_Item [IP: 0000] ####
    #### GHI.Glide.Display.DisplayObjectContainer::OnTouchUp [IP: 001a] ####
    #### GHI.Glide.Display.Window::TouchUpEvent [IP: 0020] ####
    #### GHI.Glide.TouchEventHandler::Invoke [IP: 0000] ####
    #### GHI.Glide.GlideTouch::RaiseTouchUpEvent [IP: 0008] ####
    #### MNTEnergy.CapTouchDriver::display_TouchUp [IP: 0022] ####


#2

I think I found it.

I dispose of Windows on clicking a button or grid etc and then create a new one.

The OnTouchUp for the DataGrid does not call e.StopPropagation(); so it still tries to propagate the old window list which is not disposed.

All the other components call this function so they don’t generate any exceptions.

By adding this line at the end I have it working. Not sure this is 100% but I now have no exceptions and I can select a cell and open a new window to edit the contents.