Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Implementing Untyped Messages for unknown message types(Implementing Untyped Messages for unknown message types)
Implementing Untyped Messages for unknown message types [message #850201] Thu, 19 April 2012 17:34 Go to next message
Eclipse UserFriend
I am trying to implement a 3dconnexion spacenavigator in an SWT application. after creating a small jni (win32 only at the moment) stub I was expecting to be able to post messages to the main Shell window using the windows SendMessage command. Then using the following in the SWT application

       
        int MY_MESSAGE = OS.RegisterWindowMessage(new TCHAR(0, "3dxEvent", true));

        shell.addListener(MY_MESSAGE, new Listener() {

            @Override
            public void handleEvent(Event event) {

                System.out.println("I cant beleive this worked");

            }

        });


Even posting a message from within the SWT application doesn't seem to work.

      OS.SendMessageW(shell.handle, MY_MESSAGE, 0, 0);

Any ideas?
Re: Implementing Untyped Messages for unknown message types [message #850991 is a reply to message #850201] Fri, 20 April 2012 10:38 Go to previous messageGo to next message
Eclipse UserFriend
OK, I've looked at the code and it appears you can't uses messages like this Sad SWT filters out unknown messages.

So the question becomes "If we have a native window accepting messages from an input device how can we send these messages to an SWT window"?
Re: Implementing Untyped Messages for unknown message types [message #856398 is a reply to message #850991] Wed, 25 April 2012 12:16 Go to previous message
Eclipse UserFriend
Hi Peter, this approach won't work. What you'll need to do:

- SWT subclasses the Windows proc. At the native level you'll have to
get and keep a handle to this subclass and then re-subclass the Windows
proc with your own Windows subclass.
- Your subclass will pass 99% of received messages (all those not from
your input device) to the stored swt subclass for normal processing.
- When a message is received from the input device then use JNI to
invoke a java method of yours.

HTH,
Grant


On 4/20/2012 10:38 AM, Peter Davis wrote:
> OK, I've looked at the code and it appears you can't uses messages like
> this :( SWT filters out unknown messages.
>
> So the question becomes "If we have a native window accepting messages
> from an input device how can we send these messages to an SWT window"?
Previous Topic:Detect a control is visible and skip drawing
Next Topic:OS X: handle reopen event (user clicked dock icon)
Goto Forum:
  


Current Time: Sat Aug 30 16:10:56 EDT 2025

Powered by FUDForum. Page generated in 0.02817 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top