Skip to main content
Known Participant
September 28, 2005
Question

Using ShiftDown or Alt Down with onSelect

  • September 28, 2005
  • 4 replies
  • 524 views
I am having no success testing for ShiftDown and the various other on-select related properties.

for example both the following issue an empty alert box regardless of the status of the shift key:

myMenuItem.onSelect = function () {alert(this.ShiftDown)}
myMenuItem.onSelect = function () {alert(myMenuItem.ShiftDown)}

I want to be able to do both of:

1. When the menu command is clicked with say ShiftDown, it toggles the checked status.
2. When the menu command is clicked with say ShiftDown, it does something different from when ShiftDown is false.

Andrew

CS2 on XP
This topic has been closed for replies.

4 replies

Known Participant
September 29, 2005
I was going to ask about that mymenucommand.onSelect = function (menu) {}

Is that normal JS syntax, haven't seen it before. 'menu' is undefined and yet appears to behave like it is some sort of object. Also, if that is the case is it's scope that of the parent.

Andrew
Known Participant
September 29, 2005
Andrew-Hall@adobeforums.com wrote:
> I was going to ask about that mymenucommand.onSelect = function (menu) {}
>

That is roughly equivalent to

function _menuCmd(menu) {}
mymenucommand.onSelect = _menuCmd;

'menu' is just the name of a formal parameter/argument that is strictly local to
the function.

function myFtn(a, b, c) {
return a+b+c;
}

'a', 'b', 'c' are the same.

ciao,
-X
Known Participant
September 29, 2005
Thanks for the kind words, Andrew.

I really enjoy working with you all and helping where I can.

Bob
Known Participant
September 28, 2005
Thanks so much Bob. Your help is invaluable, really makes a lot of things possible.
Andrew
Known Participant
September 28, 2005
Try this, Andrew:

#target bridge

MenuModifierTester = {};
MenuModifierTester.doIt = function( menu ) {
var str = "Alt Down: " + menu.altDown + " Cmd Down: " + menu.cmdDown + " Ctrl Down: " + menu.ctrlDown + " Shift Down: " + menu.shiftDown;
alert( str );
}

createMenu( "command", "Menu Modifier Tester", "at the end of Tools", "Tools/mmt", MenuModifierTester.doIt );

Bob