Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Exposing NCLBUTTON* and NCRBUTTON* via listeners


We couldn't expose WM_NCLBUTTONDOWN as API because it's a Windows only message.  Although SWT does have the concept of client area, events in non-client area are not modeled.  The is because, for example, on X windows systems, when the user clicks in the title bar, the event goes to the window manager, not SWT so we couldn't offer mouse events in the title bar and be portable.

If you know you are only running on Windows, you can patch SWT.  There are also low level win32 hooks that you can use to intercept every Windows message that goes to an application.  NOTE: If you did this and your code is slow, you will affect the performance of the entire application.

> that's windows non-client area, e.g. shell decoration and main menu.

In the case of the main menu, you could filter on SWT.Show for menus and hide your custom menu when the operating system shows the native one.  For the title area, you could filter on shell events SWT.Move, SWT.Resize, SWT.Iconify etc. and hide your menu when the user performed one of these actions.  I have not tried it but it should be "ok".

Doing both of these things could get you closer, but it won't be the same as WM_NCLBUTTONDOWN.



Łukasz Milewski <lukasz.milewski@xxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

03/13/2009 12:33 PM

Please respond to
"Eclipse Platform SWT component developers list."        <platform-swt-dev@xxxxxxxxxxx>

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
[platform-swt-dev] Exposing NCLBUTTON* and NCRBUTTON* via listeners





Hi,

To create custom popup menu, I'm showing shell (containing all widgets
and drawing) without actually focusing on it. I need it this way,
because parent shell has a lot of logic related to losing focus. After
that I want to close that popup shell when click outside of it. I'm
able to accomplish 95% of cases for that using Display filters, but
there's one place I'm not able to intercept events - that's windows
non-client area, e.g. shell decoration and main menu.

I did some digging around this and found that WM_NCLBUTTONDOWN window
proc message is sent when left mouse button click event occurs on
window decoration and main menu.

Would there be a possibility of introducing ability to listen for those events?

I've also sent this message to the newsgroup, I don't know where does
kind of question should be addressed.

Regards,
Lukasz Milewski
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top