• 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: Contextual menus not passing mousedown events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contextual menus not passing mousedown events


  • Subject: Re: Contextual menus not passing mousedown events
  • From: Axel Andersson <email@hidden>
  • Date: Wed, 22 Jun 2005 15:23:17 +0200

On Jun 22, 2005, at 03:15, Theodore H. Smith wrote:

What am I doing wrong? How do I first let the mousedown event pass, so the row the user clicked on is selected, before opening the menu?

I'm doing the following in an NSTableView subclass when I want that behaviour:


- (NSMenu *)menuForEvent:(NSEvent *)event {
    int    row;

row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];

    if(row >= 0) {
        if(![self isRowSelected:row])
            [self selectRow:row byExtendingSelection:NO];

        return [super menuForEvent:event];
    }

    return nil;
}

-selectRow:byExtendingSelection: was deprecated in Mac OS X 10.3, but you get the idea.

Hope this helps,

-- Axel

_______________________________________________
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: 
 >Contextual menus not passing mousedown events (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Design Dilemma ...
  • Next by Date: Re: Design Dilemma ...
  • Previous by thread: Contextual menus not passing mousedown events
  • Next by thread: NSTreeController and Core Data: creating abstract entities?
  • Index(es):
    • Date
    • Thread