Call a "invokeAction' of the Menu item button

Hello

If I have a button and you wrote the code for the invokeAction method is, it is possible to call this button to a menu item invokeAction method?

I guess I could just copy the code from this button and add it to the menu. I'm really wondering if there is an easier way.

(Sorry if this has already been achieved in this forum, I'm not sure what kind of search terms I would use to find a solution to my question.)

Thank you!

invokeAction is protected, so you can not call it directly. You can play games such as deriving from a subclass with invokeAction made public. But it is usually easier to have just the listening port of the button and the listener of the element menu to call a common method. It's simple and obvious if the listeners are in the same module of code and a little more complicated if they are not, of course.  In general the code duplication is a bad idea, but it's even worse if duplicates are in different modules.

Tags: BlackBerry Developers

Similar Questions

  • Folder level Javascript executes the Menu item, but not button - need a work around... Help, please

    I have a JavaScript that contains a function of confidence with a SOAP operation inside the confidence function.

    This function is inside a folder level script.

    When calling this function to a menu item, it works fine.

    When I try to add and call this function from a button or a Signature field to the title of JavaScript execution when signed, it will not work and I get an error message.

    What I'm missing and there is a work around, I need to run it from a button or a signature field?

    Any ideas?

    How to run privileged Javascript by a button

    //    1.  Need to put the necessary Javascript inside a function in the Javascripts folder

    //    2.  Javascript must be a function of trust

    //    3.  Add the call to the function of trust to the button

    //

    The Code for the button to execute a script Javascript on the Focus of the mouse is-> Trusted_CustomCode();

    //

    The following example is a JavaScript script at level folder for security reasons

    //

    The example code SHOULD BE wrapped in a function of trust which is part of .js in the javascripts folder

    //

    var Trusted_CustomCode = app.trustedFunction (CustomCode);

    function CustomCode() {}

    app.beginPriv ();

    Insert the custom JavaScript Code here

    App.Alert ("this is my custom Code that is running from a button");

    End of the custom Javascript Code

    app.endPriv ();

    }

  • the menu item run method not called

    Eclipse SDK Version: 3.4.1

    BlackBerry JDE plugin for Eclipse Version: 1.0.0.50

    BlackBerry JDE component package Version: 4.5.0.14

    I added a menu item to the contacts list. I would like to get the context when the user clicks the menu item, but the run method is not entered. When the user clicks the item in the menu the main routine is entered with correct arguments. Should not called run with the context method? No exception is thrown.

     

    Import net.rim.blackberry.api.menuitem.ApplicationMenuItem;
    Import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
    Import net.rim.device.api.system.Application;
    Import net.rim.device.api.system.ApplicationDescriptor;

    SerializableAttribute public class BwMain extends Application {}
    private static final long APP_ID = 0xf46f5a7867d69ff0L;
    private static final String ARG_LAUNCH_BW = "1";

    public BwMain() {}
    long menuItemLocation = ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST;
    ContactsBwMenuItem menuItem = new ContactsBwMenuItem();
    ToolBarMenuButton.AddMenuItem (menuItemLocation, ARG_LAUNCH_BW, menuItem);
    System.Exit (0);
    }

    Public Shared Sub main (String [] args) {}
    If (args == null | args.length == 0) {}
    BwMain bwMain = new BwMain();
    bwMain.enterEventDispatcher ();
    }
    else {}
    System.out.println ("App launched from the menu");
    }
    }

    private public static Sub ToolBarMenuButton.AddMenuItem (long location, String argOfAppl, ApplicationMenuItem appMenuItem) {}
    Amir ApplicationMenuItemRepository = ApplicationMenuItemRepository.getInstance ();
    ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor ();
    app = new ApplicationDescriptor (app, new String [] {ARG_LAUNCH_BW});
    amir.addMenuItem (location, appMenuItem, app);
    }

    private static class ContactsBwMenuItem extends ApplicationMenuItem {}
    {ContactsBwMenuItem()}
    Super (20);
    }

    public String toString() {}
    return "PC connection";
    }

    public Object execute (object context) {}
    try {}
    System.out.println ("input run method");
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    Returns a null value.
    }
    }
    }

    You call system.exit() in the Builder before entering the EventDispatcher. I'm guessing that you add the menu item, but leave the application, and when the menu item is called it is more a reference to the context of the application and decides not to continue. The menu item will not remove itself when the application closes.

  • Where is the menu item "update iTunes game"?

    I am on iTunes 12.4 (Mac) and the menu item "Update of iTunes game" has disappeared from this version. The music library on my Macbook Pro is not sync to the cloud to be available on my iPhone, even if both are signed on the same account and my game subscription is current/paid.

    Thank you, Apple, to make things more difficult that they'll be removing the menu option to force a sync

    Now, how do I just that... force my laptop to update the game?

    The button 'Update iTunes game' old responsibility now 'Updated iCloud music library' file/library.

  • Failed to add the menu item «Edit adjustment...» "action

    Hello

    I have an action in which I want to change an existing adjustment layer. I can't save the menu item «Edit adjustment...» "in the drop down palette layers.

    To add the step, I tried the following steps:

    1. Select the adjustment layer thumbnail icon
    2. Select «Insert Menu Item»... "in the menu palette flyout
    3. Choose "Edit settings...". "in the menu of the layers palette (how the window insert a Menu item" Menu item: layers: change the setting ")
    4. Press the OK"" button.

    This adds nothing to the action; usually, hit OK adds the menu item.

    I'm doing this right? Is this a known bug? As a solution, can someone point me to action with the step of "Edit settings...". "already in there? Thank you.

    Photoshop CC 2015.1.2 (20160113.r.355 x 64)

    Mac OS X 10.11.3

    I think that you make it harder than it is.  Just record the action and adjust the adjustment layer, you add during the recording of the action.  When did you record the action you should see that there two steps were recorded for the adjustment layer, you added during the recording of the action. "Do adjustment layer" and "current adjustment layer Set.  Insert a stop message with continue after the "make the adjustment layer ' step and check activate the dialog box in step"Set current adjustment layer".»  Layer when allowed by using the action, you can uncheck the walk of the stop.

  • Help with the Menu item

    I created an action that...

    1. Select a Smart Object Layer, called YOUR IMAGE
    2. Selects the Menu item > layer > Smart Object > replace content

    Action 100% work, but when I convert the action of a script and run it, the IMAGE of YOUR gets selected the menu Item does not show.

    Can anyone help please.

    cTID = function(s) { return app.charIDToTypeID(s); };
    sTID = function(s) { return app.stringIDToTypeID(s); };
    
    //==================== Load Image ==============
    function LoadImage() {
      // Select
      function step1(enabled, withDialog) {
        if (enabled != undefined && !enabled)
          return;
        var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
        var desc1 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putName(cTID('Lyr '), "YOUR IMAGE");
        desc1.putReference(cTID('null'), ref1);
        desc1.putBoolean(cTID('MkVs'), false);
        var list1 = new ActionList();
        list1.putInteger(9);
        desc1.putList(cTID('LyrI'), list1);
        executeAction(cTID('slct'), desc1, dialogMode);
      };
    
    
      // Select
      function step2(enabled, withDialog) {
        if (enabled != undefined && !enabled)
          return;
        var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
        var desc1 = new ActionDescriptor();
        var ref1 = new ActionReference();
        ref1.putEnumerated(cTID('Mn  '), cTID('MnIt'), sTID("placedLayerReplaceContents"));
        desc1.putReference(cTID('null'), ref1);
        executeAction(cTID('slct'), desc1, dialogMode);
      };
      step1();      // Select
      step2();      // Select
    };
    LoadImage.main = function () {
      LoadImage();
    };
    LoadImage.main();
    

    You have the withDialog variable, but I don't see how define you it. Is a UI checkbox if you don't understand? How do populate you this value?

  • debugging automatically when you call a script of a menu item

    Hi all

    I just came across a question I was wondering if anyone can help me or point me in the right direction.

    I have two startup scripts.

    Some custom menu items and actions that call a few other custom scripts running in the 'session' and ups configurations target engine.

    The other runs in my own custom session and is used to initialize and share common constants and functions between my custom scripts.

    This all seems to work as expected and by clicking on the new menu item calls, the correct script however, even without the ExtendedScript Toolkit running as soon as I click on the menu item, it will load the ESTK and break on the first line of the script. If I press F5 to continue the treatment, it will end and works very well.

    I use currently the package has excellent (http://extendables.org/) to make some HTTP and simplify the creation of the user interface that does not specify a session.

    Nobody knows what causes the scripts to debug automatically or is there a setting that can be defined to cause this?

    This is caused by the 'session' calling 'customSession' using the code that runs in the 'main' session by default?

    This really is irritating me at the moment so if anyone can help it would be much appreciated.

    All this is done using JavaScript in InDesign CS 5.5

    Thanks in advance

    followed a line in the package has:

    level of $ = 2;

    I then went on the extensible site on github to raise what a problem only to find out someone had already pointed out, I didn't see the question before. DOH!

    Anyway thought i better update incase someone else on the forums try to use the package and meet this Issus.

  • Definition programmatically the menu item & quot; permit & quot;.

    I have a soft LOOK that offers a menu point which, when selected launches a dialog box.

    I need set the enabled property of the item of menu false after it is selected, that only one instance of this dialog box is expected to be launched, and I don't want to make the modal dialog box. I also need to set the property enabled to true when the dialog box is closed.

    I do this through the defaultDataDescriptor?

    BTW, the dialog box that starts is not a popup, it's in an AIR application in the main window, in what I call the 'activities '.

    I don't know if that's how I had to do, but I create an associative array object and when I disable a menu item in the ItemClick event (if it is a menu item that needs to be deactivated at the time), I store a reference to the menu item in the object. Then when I close the dialog box I have uses the reference to re - activate the menu item.

  • Messages arrive, but the "Inbox" or any other folder open even if the content still there (and almost all the menu items do not work)!

    Using last Thunderbird on Windows 7. Had problems with the operating system and had to use a system restore. When I opened TB, it displays the folders in the left pane, but the credits of "Thunderbird Mail-...» "and the 3 topics: E-mail; Accounts; and advanced features. None of the files would open. I used the "Search messages" function and has been able to show existing and new messages in the 'Inbox '. Also wanted to know if files are always in my 'profile'... and they were all there where they should be. (And almost all the menu items are disabled).
    I wonder if I need to reinstall Thunderbird... maybe the OS issues this morning - and restore - have corrupted or damaged key elements of the program?
    Thank you...

    System Restore is not always a very good thing for applications.

    Reinstall is unlikely to help. But if your accounts are all imap and that you do not have a lot of other data (address book, for example) in Thunderbird, you could start from scratch.

    But before that, you should try Thunderbird started in SafeMode https://support.mozilla.org/en-US/kb/safe-mode-thunderbird

  • What is the menu item "Bring everything to the front ', and how to use it?

    What is the menu item "Bring everything to the front ', and how to use it?

    It's a selection in the window menu and means to bring all open windows of this application at the front and push all the windows open for other applications behind. This makes access to the easiest application windows. However, if you don't have that one window open in an application, then the menuitem does nothing.

  • Disable the menu item in the third party application (such as Photoshop)

    Please suggest me to disable the menu item in the third party application (such as Photoshop).

    Hello

    I suggest you to send your query to the following link:

    Photoshop Help Center: http://www.adobe.com/support/photoshop/

    Hope this information is useful.

  • Add the Menu item to default custom Blackberry file browser

    Hello

    I try to add the Menu item by default Blackberry file browser.

    I want to add the menu item 'PRINT' files. It is when I browse through the media-> Explore-> photo, we get a list of images and when clicked on the Menu. I expect the element menu to print it.

    I use ApplicationMenuItemRepository to achieve this. And the documentation says.

    MENUITEM_FILE_EXPLORER
              ApplicationMenuIteminstances registered with this ID appear when the file Explorer application is running.

    MENUITEM_FILE_EXPLORER_BROWSE
              ApplicationMenuIteminstances registered with this ID appear when a user uses the Windows Explorer application to browse files and folders.

    MENUITEM_FILE_EXPLORER_ITEM
              ApplicationMenuIteminstances registered with this ID appear when a user uses the file Explorer application to open a file.

    Whence this Explorer of files mentioned in the CIHI means. I added the Menu item in the browser, and I could see the IMPRESSION here. But I don't know where this IMPRESSION would be visible IF we add the menu item to one of them.

    Thanks in advance.

    Provision ApplicationDescriptor solved my problem.

  • Remove the Menu item

    Hello

    I add a menu item in the MENUITEM_SYSTEM and then I would remove it, but even I use ApplicationMenuItemRepository.getInstance ()... removeMenuItem (ApplicationMenuItemRepository.

    MENUITEM_SYSTEM, myMenuItem); the menu item, always in the list of the menu. Anyone know how to remove it?

    Thank you

    Make sure it is the correct menu item you have added (check the object id).

    You can use the runtime store to ensure this on multiple instances / (as an autostart entry point)

  • Add the menu item to app mail as the mail message?

    Hello

    I know how to add menu items in the mail application, but can I add one, according to the mail message? I want to send a single something in an email and after that one of my applications.

    Is it possible to do? Perhaps a listener?

    Thank you

    Matthias

    Hello Matthias.

    Well, if I understand your message, it's that - you send mail with unique label or message (something unique added with the text of the message) and you want to add the menu item when a user opens the message.

    According to my understanding - I have a solution.

    We have a listener "VeiwExtendedListener", that provide notifications for new, open, close, reply, and forward.

    You can implement this listener and to open(), you get the instance of the message object, which is open.  With this object message get the content of the message, locate the tag unique in the text of the message, if it is in the message, and then add your menu item.

    I hope this will help

    Good luck

    -Nidhi

  • The menu items are reversed in Tablet and mobile display

    I don't know what went wrong with the Web site, www.cebumerchants.com, the menu items are reversed in the mobile and view tablet, but not for the office.

    Can someone please take a look? I need to solve this problem.

    This one is pretty simple. You use float: right on your query support desktop and float: left for the little ones to your selector "nav li '...

Maybe you are looking for