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
    vector

    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.dll!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.dll!System.Windows.Forms.Control.PreProcessMessage(System.Windows.Forms.Message msg = {System.Windows.Forms.Message}) + 0x96 bytes 
      system.windows.forms.dll!ThreadContext.LocalModalMessageLoop(System.Windows.Forms.Form form = {Xceed.Editors.Design.ItemsSelector}) + 0x1bc bytes 
      system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x224 bytes 
      system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = 4, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.Application.ModalApplicationContext}) + 0x50 bytes 
      system.windows.forms.dll!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form form = {Xceed.Editors.Design.ItemsSelector}) + 0x34 bytes 
      system.windows.forms.dll!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.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.ShowDialog(System.Windows.Forms.Form dialog = {Xceed.Editors.Design.ItemsSelector}) + 0x17a bytes 
      xceed.editors.design.dll!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.dll!System.Windows.Forms.PropertyGridInternal.GridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x74 bytes 
      system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyDescriptorGridEntry.EditPropertyValue(System.Windows.Forms.PropertyGridInternal.PropertyGridView iva = {System.Windows.Forms.PropertyGridInternal.PropertyGridView}) + 0x1b bytes 
      system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.PopupDialog(int row = 9) + 0x71d bytes 
      system.windows.forms.dll!System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnBtnClick(System.Object sender = {System.Windows.Forms.PropertyGridInternal.DropDownButton}, System.EventArgs e = {System.EventArgs}) + 0x90 bytes 
      system.windows.forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e = {System.EventArgs}) + 0x5e bytes 
      system.windows.forms.dll!System.Windows.Forms.Button.OnClick(System.EventArgs e = {System.EventArgs}) + 0x53 bytes 
      system.windows.forms.dll!System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {X=10 Y=11 Button=Left}) + 0x133 bytes 
      system.windows.forms.dll!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.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x49b bytes 
      system.windows.forms.dll!System.Windows.Forms.ButtonBase.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x121 bytes 
      system.windows.forms.dll!System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x85 bytes 
      system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes 
      system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes 
      system.windows.forms.dll!System.Windows.Forms.NativeWindow.Callback(int hWnd = 263552, int msg = 514, int wparam = 0, int lparam = 720906) + 0x4a bytes 

  • User profile image
    vector

    This problem seems to occurrs only with modal windows.

    BTW when I replace in EditValue() :

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

    by

     mForm.Show();

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

    Also replacing with:

    mForm.ShowDialog();

    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.