Re: Moving controls interactively
Andy Lee <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sep 27, 2009, at 4:29 AM, Ken Ferry wrote: > I would suggest implementing -[NSView hitTestForEvent:] on a canvas > view in which all of your controls sit. This allows you to handle > the event in your canvas rather than letting it propagate to the > controls. Check out the docs. This makes sense. For one thing, it means the whole window doesn't have to have the draggable-controls behavior. You might want to reserve some part of the window where controls behave normally -- for example, a checkbox to toggle the dragging behavior on and off, or a button to revert the controls to their original positions. Make sure you figure out the right view to drag around. For example, if the user clicks in an NSTableView, you probably don't want to drag the NSTableView itself but rather its enclosingScrollView. On Sep 27, 2009, at 2:00 AM, Andrea D'Amore wrote: > What did you mean by suggesting to add a category on control classes? I hadn't thought it all the way through, but I was imagining you *might* want to put some logic at the individual view level. It might make sense to have a "doMyDraggingStartingWithMouseDown:" method in a category of one or more view classes. The top-level class would then call that method and it would do the right thing for the right classes. But maybe you don't need this and everything can go into the top-level class. --Andy