Fokus on C# Dialog

Hello,

I have a c# addon dialog. I like to have an event, if the dialog changes to active (dialog has blue title), or if the mouse is doing something else inside the MicroStation and the dialog changes to deactive (dialog has grey title).

The frame-class is inherited from Bentley.MicroStation.WinForms.Adapter.
But none of these events (Focus deactivate, Focus activate, Focus enter, Focus leave, Mouse enter, mouse leave) show up, if the were defined for the frame itself. The work fine on items

Any idea?

Thanks a lot

Volker

Parents
  • Another way to capture mouse activation events on your form is to override WndProc like this. Not sure if there's an equivalent for deactivation:

    protected override void WndProc (ref Message message)
        {
        const int WM_MOUSEACTIVATE = 0x0021;
        if (WM_MOUSEACTIVATE == message.Msg)
            ...
        }

     

Reply
  • Another way to capture mouse activation events on your form is to override WndProc like this. Not sure if there's an equivalent for deactivation:

    protected override void WndProc (ref Message message)
        {
        const int WM_MOUSEACTIVATE = 0x0021;
        if (WM_MOUSEACTIVATE == message.Msg)
            ...
        }

     

Children
  • Jeff,

    Interesting idea, but unfortunately this is only half of a possible solution.

    Just to test it, I have added this to my class:

    protected override void WndProc(ref Message inMessage)
    {
    System.Diagnostics.Debug.WriteLine(inMessage.ToString());
    base.WndProc(ref inMessage);
    }

    If I re-enter the dialog I got every time:

    msg=0x7 (WM_SETFOCUS) hwnd=0x61498 wparam=0x2166c lparam=0x0 result=0x0
    msg=0x8 (WM_KILLFOCUS) hwnd=0x61498 wparam=0x414ba lparam=0x0 result=0x0
    msg=0x281 (WM_IME_SETCONTEXT) hwnd=0x61498 wparam=0x0 lparam=0xffffffffc000000f result=0x0

    This is more then enough for me.

    But I did not receive any message, when I am leaving the dialog. And this is the more important part for me.

    Thanks!

    Volker

    Mit freundlichen Grüßen / Best regards
    Volker Hüfner

    |  AB_DATE Engineering  Software   |  ab-date.de  |