Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using ShiftDown or Alt Down with onSelect

New Here ,
Sep 27, 2005 Sep 27, 2005
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
TOPICS
Scripting
448
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 28, 2005 Sep 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 28, 2005 Sep 28, 2005
Thanks so much Bob. Your help is invaluable, really makes a lot of things possible.
Andrew
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 29, 2005 Sep 29, 2005
Thanks for the kind words, Andrew.

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

Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 29, 2005 Sep 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 29, 2005 Sep 29, 2005
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines