Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to create live-tracking button?




On Aug 1, 2007, at 4:35 PM, Nick Jackiw wrote:

Hi,

Is there a way to override any form of button control or HIView so that I can do live tracking while the button is being pressed, but leave it up to the Toolbox to handle tracking and appearance of the button between pressed and non-pressed states? My goal is a button that performs a periodic action for as long as it's pressed (think: "continuous zoom in").

The best I've come up with so far is to add a kEventControlClick handler to an image-based-button created by CreatePictureControl() or CreateBevelButtonControl(). I only get this event once per click (immediately on mousedown). From there I could enter my own stilldown loop using TrackMouseLocation, and do all of the mouse- tracking and button redrawing myself using HITheme API and HIViewDrawCGImage, while simulateously using a periodic timer to fire tracking events to my actual logic. This seems close to reimplementing a button's whole appearance and mouse-behavior logic from scratch: all the ControlRef is doing is defining the ControlBounds and sending me kEventControlClick. Am I missing something obvious, or is this as good as it gets?

I think your kEventControlClick handler could simply install a timer, call CallNextEventHandler (which will invoke the toolbox's default tracking code and not return until the user releases the mouse), and then remove the timer. Your timer will fire while the toolbox is tracking the mouse in the control.


-eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >how to create live-tracking button? (From: Nick Jackiw <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.