• 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: Draggable buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Draggable buttons


  • Subject: Re: Draggable buttons
  • From: Serge Meynard <email@hidden>
  • Date: Sat, 02 Feb 2002 21:27:42 -0500

on 2/2/02 8:19 PM, Matt Neuburg at email@hidden wrote:

> On Sat, 2 Feb 2002 12:52:15 -0500, Ben Chess <email@hidden> said:
>
>> The only way to start a non-TableView drag that I know of is
>> dragImage:at:offset:event:pasteboard:source:slideBack. The docs state
>> clearly that this is to only be called from a mouseDown event. Throwing
>> caution into the wind, I tried saving the mouseDown event and then not
>> making a call to dragImage until a move occurs, but it doesn't work
>> correctly. It seems to be capturing mouse movements, but the image
>> dragged is never drawn.
>>
>> I'm doing something like this in an NSResponder subclass:
>> -(void)mouseDown:(NSEvent *)theEvent
>> -(void)mouseMoved:(NSEvent *)theEvent
>
> In a similar situation recently I found the example in the docs
> (HandlingMouseEvents.html) very helpful. Basically you just run your own
> event loop inside the mouseDown event and see what develops. m.

The book "Cocoa programming for MacOS X" has a great example in chapter 18.
Get it if you don't have it, it's definitely worth it!
Based on what you said in your message, I think the problem is you
implemented your "dragImage:" call in "mouseMoved:", when it should actually
be in "mouseDragged:". "mouseMoved:" gets called to track the pointer when
the mouse button is up, and "mouseDragged:" when it is down.

Serge


References: 
 >Re: Draggable buttons (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Draggable buttons
  • Next by Date: Re: Disabling NSButton programmatically? -- Never mind...
  • Previous by thread: Re: Draggable buttons
  • Next by thread: How to use functions of Kernel.framework? (especially Blowfish)
  • Index(es):
    • Date
    • Thread