Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Application.Idle not triggered when using UITypeEditor in a ShowDialog() .NET

Back to Forum: Tech Off
  • User profile image

    Here is a strong one.

    I need to use my own controls in a modal window when editing a value of type collection from the property grid.

    My UITypeEditor invokes a ShowDialog() on form during an EditValue().

    Controls on that form subscribe to Application.Idle event when a TAB key is pressed.

    But that event is only triggered when the form closes. I was expecting this event to trigger before. The same exact code behaves as expected in a normal windows form application.

    I am using the following:
    Microsoft Visual C# .NET   69586-335-0000007-18701
    Microsoft Visual Studio .NET 2003 Hotfix (KB830348)  
    .NET 1.1
    VS 2003

    Here is the stack trace in when I register to Application.Idle.

    Thanks for your help.!System.Windows.Forms.Control.ProcessCmdKey(System.Windows.Forms.Message msg = {System.Windows.Forms.Message}, System.Windows.Forms.Keys keyData = Tab) + 0x72 bytes!System.Windows.Forms.Control.PreProcessMessage(System.Windows.Forms.Message msg = {System.Windows.Forms.Message}) + 0x96 bytes!ThreadContext.LocalModalMessageLoop(System.Windows.Forms.Form form = {Xceed.Editors.Design.ItemsSelector}) + 0x1bc bytes!ThreadContext.RunMessageLoopInner(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x224 bytes!ThreadContext.RunMessageLoop(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x50 bytes!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form form = {Xceed.Editors.Design.ItemsSelector}) + 0x34 bytes!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window owner = {Microsoft.VisualStudio.Designer.Shell.DesignerPackage.NativeHandleWindow}) + 0x6ab bytes 
      microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Shell.DesignerPackage.ShowDialog(System.Windows.Forms.Form form = {Xceed.Editors.Design.ItemsSelector}) + 0xf5 bytes!System.Windows.Forms.PropertyGridInternal.PropertyGridView.ShowDialog(System.Windows.Forms.Form dialog = {Xceed.Editors.Design.ItemsSelector}) + 0x17a bytes!Xceed.Editors.Design.ItemsUIEditor.EditValue(System.ComponentModel.ITypeDescriptorContext context = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry}, System.IServiceProvider provider = {System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry}, System.Object value = {Xceed.Editors.ComboBoxItemList}) Line 39 + 0x13 bytes C#!System.Windows.Forms.PropertyGridInternal.GridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x74 bytes!System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x1b bytes!System.Windows.Forms.PropertyGridInternal.PropertyGridView.PopupDialog(int row = 9) + 0x71d bytes!System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnBtnClick(System.Object sender = {System.Windows.Forms.PropertyGridInternal.DropDownButton}, System.EventArgs e = {System.EventArgs}) + 0x90 bytes!System.Windows.Forms.Control.OnClick(System.EventArgs e = {System.EventArgs}) + 0x5e bytes!System.Windows.Forms.Button.OnClick(System.EventArgs e = {System.EventArgs}) + 0x53 bytes!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {X=10 Y=11 Button=Left}) + 0x133 bytes!System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, int clicks = 1) + 0x261 bytes!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes!System.Windows.Forms.ButtonBase.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x121 bytes!System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x85 bytes!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes!System.Windows.Forms.NativeWindow.Callback(int hWnd = 263552, int msg = 514, int wparam = 0, int lparam = 720906) + 0x4a bytes 

  • User profile image

    This problem seems to occurrs only with modal windows.

    BTW when I replace in EditValue() :

     ( IWindowsFormsEditorService )provider.GetService( typeof ( IWindowsFormsEditorService ) ).ShowDialog( mForm );



    Application.Idle is trigerred correctly, but my form is not modal.

    Also replacing with:


    results in my form being modal but get the Idle events problem.

  • User profile image
    Frank Hileman

    Are you still having a problem? We also had the same problem. The solution for us was to avoid using the idle event on those forms. The other method of showing a form is not the "official" method, so I wonder what the bad side effects are.

    If you cannot use an idle method, and you created the controls, you can always fake it with a Windows.Forms.Timer. Those are called at about the same frequency an idle event is fired.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.