• 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: Command-click table in background app SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command-click table in background app SOLVED


  • Subject: Re: Command-click table in background app SOLVED
  • From: Bill Cheeseman <email@hidden>
  • Date: Fri, 02 Jun 2006 06:53:12 -0400
  • Thread-topic: Command-click table in background app SOLVED

on 2006-06-01 8:32 AM, Bill Cheeseman at email@hidden wrote:

> The solution is to subclass NSTableView and override -mouseDown: to deal
> differently with a Command-click when the application is in the background,
> like so:
>
> @implementation PFClickthroughTableView
>
> - (void)mouseDown:(NSEvent *)event {
>     if (![NSApp isActive] && ([event modifierFlags] & NSCommandKeyMask)) {
>         int row = [self rowAtPoint:[self convertPoint:[event
> locationInWindow] fromView:nil]];
>         if ([[self delegate] tableView:self shouldSelectRow:row]) {
>             [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row]
> byExtendingSelection:NO];
>             [self sendAction:[self action] to:nil];
>         }
>         return;
>     }
>     [super mouseDown:event];
> }
>
> @end

The -sendAction:to: method is better sent like this:

   [self sendAction:[self action] to:[self target];

-- in case the target is not in the responder chain. In IB, of course, the
"custom class" of the table must be set to PFClickthroughTableView and the
table must be connected to its action method.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes


 _______________________________________________
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: 
 >Command-click table in background app SOLVED (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: NSTableView: column selection selects rows?
  • Next by Date: Re: Newbie error
  • Previous by thread: Command-click table in background app SOLVED
  • Next by thread: Re: Command-click table in background app SOLVED
  • Index(es):
    • Date
    • Thread