Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT Carbon internal event handling
SWT Carbon internal event handling [message #443973] Tue, 05 October 2004 06:04 Go to next message
Eclipse UserFriend
Originally posted by: eclipse.physarum.net

Hi,

I'm trying to use the internal Carbon API in SWT to register a Carbon
event handler for pen input (kEventTabletPointer).

This seems to work:

int shellHandle = OS.GetControlOwner(shell.handle);
int eventTarget = OS.GetWindowEventTarget(shellHandle);
OS.InstallEventHandler(eventTarget, tabletProc, mask.length/2, mask, 0,
null);

The above code installs the handler to the Shell/window.

Now I'm trying to install the handler only to a specific Control (say, a
Canvas object). Can I use the public '.handle' field in Control objects
(eg. canvas.handle) for 'OS.GetControlEventTarget' ?

The code below doesn't seem to work:

int controlTarget = OS.GetControlEventTarget(canvas.handle);
OS.InstallEventHandler(controlTarget, tabletProc, mask.length/2, mask,
0, null);

I noticed in Scrollable.java and Composite.java (parents of Canvas),
there's a private '.scrolledHandle'. Is this what I need to use instead?

Any idea?

Thanks,
stan
Re: SWT Carbon internal event handling [message #444139 is a reply to message #443973] Thu, 07 October 2004 15:01 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Googling around for kEventTabletPointer and the other constants in the same
area gives nothing useful. I couldn't find an example of how to use this
thing in any Apple doc or any other code on the Web. Assuming that the
tablet works like a mouse, you can't listen for events on a particular
control. SWT listens for mouse events for the whole application and each
top level window and dispatches them to the "right" SWT object that
represents a Macintosh control. You'll need to do something similar.
Investigate the implementation of Display.mouseProc() and friends.

"Stanley Gunawan" <eclipse@physarum.net> wrote in message
news:cjtdh1$eb2$1@eclipse.org...
> Hi,
>
> I'm trying to use the internal Carbon API in SWT to register a Carbon
> event handler for pen input (kEventTabletPointer).
>
> This seems to work:
>
> int shellHandle = OS.GetControlOwner(shell.handle);
> int eventTarget = OS.GetWindowEventTarget(shellHandle);
> OS.InstallEventHandler(eventTarget, tabletProc, mask.length/2, mask, 0,
> null);
>
> The above code installs the handler to the Shell/window.
>
> Now I'm trying to install the handler only to a specific Control (say, a
> Canvas object). Can I use the public '.handle' field in Control objects
> (eg. canvas.handle) for 'OS.GetControlEventTarget' ?
>
> The code below doesn't seem to work:
>
> int controlTarget = OS.GetControlEventTarget(canvas.handle);
> OS.InstallEventHandler(controlTarget, tabletProc, mask.length/2, mask,
> 0, null);
>
> I noticed in Scrollable.java and Composite.java (parents of Canvas),
> there's a private '.scrolledHandle'. Is this what I need to use instead?
>
> Any idea?
>
> Thanks,
> stan
Re: SWT Carbon internal event handling [message #444155 is a reply to message #444139] Thu, 07 October 2004 22:21 Go to previous messageGo to next message
Andre Weinand is currently offline Andre WeinandFriend
Messages: 66
Registered: July 2009
Member
My Wacom Tablet just works fine with Eclipse and SWT.
Are you trying to read the pen pressure information from the tablet?

--andre



On 7.10.2004 17:01 Uhr, in article ck3le0$vsj$1@eclipse.org, "Steve
Northover" <steve_northover@ca.ibm.com> wrote:

> Googling around for kEventTabletPointer and the other constants in the same
> area gives nothing useful. I couldn't find an example of how to use this
> thing in any Apple doc or any other code on the Web. Assuming that the
> tablet works like a mouse, you can't listen for events on a particular
> control. SWT listens for mouse events for the whole application and each
> top level window and dispatches them to the "right" SWT object that
> represents a Macintosh control. You'll need to do something similar.
> Investigate the implementation of Display.mouseProc() and friends.
>
> "Stanley Gunawan" <eclipse@physarum.net> wrote in message
> news:cjtdh1$eb2$1@eclipse.org...
>> Hi,
>>
>> I'm trying to use the internal Carbon API in SWT to register a Carbon
>> event handler for pen input (kEventTabletPointer).
>>
>> This seems to work:
>>
>> int shellHandle = OS.GetControlOwner(shell.handle);
>> int eventTarget = OS.GetWindowEventTarget(shellHandle);
>> OS.InstallEventHandler(eventTarget, tabletProc, mask.length/2, mask, 0,
>> null);
>>
>> The above code installs the handler to the Shell/window.
>>
>> Now I'm trying to install the handler only to a specific Control (say, a
>> Canvas object). Can I use the public '.handle' field in Control objects
>> (eg. canvas.handle) for 'OS.GetControlEventTarget' ?
>>
>> The code below doesn't seem to work:
>>
>> int controlTarget = OS.GetControlEventTarget(canvas.handle);
>> OS.InstallEventHandler(controlTarget, tabletProc, mask.length/2, mask,
>> 0, null);
>>
>> I noticed in Scrollable.java and Composite.java (parents of Canvas),
>> there's a private '.scrolledHandle'. Is this what I need to use instead?
>>
>> Any idea?
>>
>> Thanks,
>> stan
>
>
Re: SWT Carbon internal event handling [message #444157 is a reply to message #444139] Fri, 08 October 2004 04:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.physarum.net

Steve Northover wrote:

> Googling around for kEventTabletPointer and the other constants in the same
> area gives nothing useful. I couldn't find an example of how to use this
> thing in any Apple doc or any other code on the Web. Assuming that the
> tablet works like a mouse, you can't listen for events on a particular
> control. SWT listens for mouse events for the whole application and each
> top level window and dispatches them to the "right" SWT object that
> represents a Macintosh control. You'll need to do something similar.
> Investigate the implementation of Display.mouseProc() and friends.
>

Thanks..
I did just that, and just basically install the event handler to the
window, and find the control pointed by the mouse, and compare the
handle of that control, to the one I passed in. If not the same, return
OS.eventNotHandledErr.

Thanks very much,
stan


> "Stanley Gunawan" <eclipse@physarum.net> wrote in message
> news:cjtdh1$eb2$1@eclipse.org...
>
>>Hi,
>>
>>I'm trying to use the internal Carbon API in SWT to register a Carbon
>>event handler for pen input (kEventTabletPointer).
>>
>>This seems to work:
>>
>>int shellHandle = OS.GetControlOwner(shell.handle);
>>int eventTarget = OS.GetWindowEventTarget(shellHandle);
>>OS.InstallEventHandler(eventTarget, tabletProc, mask.length/2, mask, 0,
>>null);
>>
>>The above code installs the handler to the Shell/window.
>>
>>Now I'm trying to install the handler only to a specific Control (say, a
>>Canvas object). Can I use the public '.handle' field in Control objects
>>(eg. canvas.handle) for 'OS.GetControlEventTarget' ?
>>
>>The code below doesn't seem to work:
>>
>>int controlTarget = OS.GetControlEventTarget(canvas.handle);
>>OS.InstallEventHandler(controlTarget, tabletProc, mask.length/2, mask,
>>0, null);
>>
>>I noticed in Scrollable.java and Composite.java (parents of Canvas),
>>there's a private '.scrolledHandle'. Is this what I need to use instead?
>>
>>Any idea?
>>
>>Thanks,
>>stan
>
>
>
Re: SWT Carbon internal event handling [message #444158 is a reply to message #444155] Fri, 08 October 2004 04:16 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse.physarum.net

Andre Weinand wrote:

> My Wacom Tablet just works fine with Eclipse and SWT.
> Are you trying to read the pen pressure information from the tablet?

Yes, and potentially other info as well..
The MacOSX Wacom driver basically sends pen events as Carbon events
(kEventTabletPointer / kEventTabletProximity).

I think it's working now, but thanks anyway.

Cheers,
stan

>
> --andre
>
>
>
> On 7.10.2004 17:01 Uhr, in article ck3le0$vsj$1@eclipse.org, "Steve
> Northover" <steve_northover@ca.ibm.com> wrote:
>
>
>>Googling around for kEventTabletPointer and the other constants in the same
>>area gives nothing useful. I couldn't find an example of how to use this
>>thing in any Apple doc or any other code on the Web. Assuming that the
>>tablet works like a mouse, you can't listen for events on a particular
>>control. SWT listens for mouse events for the whole application and each
>>top level window and dispatches them to the "right" SWT object that
>>represents a Macintosh control. You'll need to do something similar.
>>Investigate the implementation of Display.mouseProc() and friends.
>>
>>"Stanley Gunawan" <eclipse@physarum.net> wrote in message
>>news:cjtdh1$eb2$1@eclipse.org...
>>
>>>Hi,
>>>
>>>I'm trying to use the internal Carbon API in SWT to register a Carbon
>>>event handler for pen input (kEventTabletPointer).
>>>
>>>This seems to work:
>>>
>>>int shellHandle = OS.GetControlOwner(shell.handle);
>>>int eventTarget = OS.GetWindowEventTarget(shellHandle);
>>>OS.InstallEventHandler(eventTarget, tabletProc, mask.length/2, mask, 0,
>>>null);
>>>
>>>The above code installs the handler to the Shell/window.
>>>
>>>Now I'm trying to install the handler only to a specific Control (say, a
>>>Canvas object). Can I use the public '.handle' field in Control objects
>>>(eg. canvas.handle) for 'OS.GetControlEventTarget' ?
>>>
>>>The code below doesn't seem to work:
>>>
>>>int controlTarget = OS.GetControlEventTarget(canvas.handle);
>>>OS.InstallEventHandler(controlTarget, tabletProc, mask.length/2, mask,
>>>0, null);
>>>
>>>I noticed in Scrollable.java and Composite.java (parents of Canvas),
>>>there's a private '.scrolledHandle'. Is this what I need to use instead?
>>>
>>>Any idea?
>>>
>>>Thanks,
>>>stan
>>
>>
>
>
Previous Topic:application for pocket PC
Next Topic:[Mac] SWT Apps and libs that use AWT
Goto Forum:
  


Current Time: Sat Oct 24 04:32:25 GMT 2020

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

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

Back to the top