• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finding out mouse button state outside of event stream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding out mouse button state outside of event stream


  • Subject: Re: Finding out mouse button state outside of event stream
  • From: Eric Schlegel <email@hidden>
  • Date: Tue, 12 Jul 2005 10:39:21 -0700


On Jul 12, 2005, at 10:32 AM, Greg Hurrell wrote:

To partly answer my own question, looks like the answer *could* be:

UInt32 GetCurrentEventButtonState(void);


GetCurrentEventButtonState determines the queue-synchronized state of the mouse button(s). You should use this function instead of the Button or GetCurrentButtonState functions.


http://developer.apple.com/documentation/Carbon/Conceptual/ Carbon_Event_Manager/Tasks/chapter_3_section_7.html


Not sure though exactly what it means by "queue-synchronized"... if it's referring to the current event for the application then it may not be what I am looking for (I want to be able to find out the button state even when my application is in the background and not handling any events).

Probably that API wouldn't do what you want, because it is designed for use in a Carbon event-based application, and AppKit (although it uses Carbon Events at the implementation level) does not dispatch most Carbon events through the Carbon event disptacher, which is required for correct behavior from GetCurrentEventButtonState.


For determining the current hardware button state, you could just use GetCurrentButtonState, which will work in either a Carbon or Cocoa- based app. Keep in mind, though, that this still won't work if your app is being controlled by remotely posted mouse events. If someone is using Apple Remote Access to control your app, GetCurrentButtonState will return the state of the mouse that is physically attached to the machine on which the app is running (which means typically the button state would be "up"), even if the remote machine's mouse button is pressed.

-eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Finding out mouse button state outside of event stream (From: Greg Hurrell <email@hidden>)
 >Re: Finding out mouse button state outside of event stream (From: Greg Hurrell <email@hidden>)

  • Prev by Date: Re: Drawing an NSImage into a GWorld
  • Next by Date: Re: Finding out mouse button state outside of event stream
  • Previous by thread: Re: Finding out mouse button state outside of event stream
  • Next by thread: Re: Finding out mouse button state outside of event stream
  • Index(es):
    • Date
    • Thread