Friday, August 23, 2019

#1 2019-04-24 05:40:01 am

Jonny_FairPlay
Member
Registered: 2019-04-17
Posts: 4

Delegating an action to a menu Item?

I can't seem to figure out how to get a menu item to run one of my handlers from my ApplesDelegate.applescript? When I try and delegate an action like everything else, it only gives me choices (apple system options?) I don't need.
I've looked on Utube but seemed to be no clearer (especially working with Applescript).
Do you need to add another delegate object and code it differently to get it to connect to an action?
Help

Offline

 

#2 2019-04-25 11:03:25 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11579
Website

Re: Delegating an action to a menu Item?

Declare the action with syntax

Applescript:

on menuAction_(sender)

and connect the menu item to the First Responder (the red cube) in Interface Builder. In the displayed list select the action.

The benefit of First Responder is that the action is called via the responder chain. A direct connection to the target class is not needed.


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)