(bb10) How to cancel an opening from context menu

I have a strange behavior with context menus.

I have two lists in my application with two context menus, a menu for each list.

I have a logic to determine if the popup should be launched or not, and if I don't stop ContextMenuEvent.OPENING event, this menu is not started. Fine. But after that, the menu popup stops working for the other list.

I think that something in the ContexMenu classes must be left in a bad state after preventDefault on the opening ceremony.

What will be the best way to stop to open a context menu and still works for the other components?

See the example...

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;

    import qnx.fuse.ui.actionbar.ActionBar;
    import qnx.fuse.ui.core.Action;
    import qnx.fuse.ui.core.ActionBase;
    import qnx.fuse.ui.core.ActionSet;
    import qnx.fuse.ui.core.TabAction;
    import qnx.fuse.ui.events.ContextMenuEvent;
    import qnx.fuse.ui.events.DragEvent;
    import qnx.fuse.ui.listClasses.List;
    import qnx.ui.data.DataProvider;

    public class TestPush extends Sprite
    {
        private var actionBarOverflow:Sprite;
        private var content:Sprite = new Sprite();

        private var slideX:Number = 0;

        public function TestPush()
        {

            super();

            // support autoOrients
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.addEventListener( Event.RESIZE, function( e:Event ):void
            {
                actBar.y = stage.stageHeight - actBar.height;
            } );

            content.addChild( new Bitmap( new BitmapData( stage.stageWidth, stage.stageHeight, false, 0xffffff ) ) );
            // support autoOrients
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;

            var dp:DataProvider=new DataProvider();
            dp.addItem({"label":"item1"});
            dp.addItem({"label":"item2"});
            dp.addItem({"label":"item3"});
            dp.addItem({"label":"item4"});
            dp.addItem({"label":"item5"});
            dp.addItem({"label":"item6"});
            dp.addItem({"label":"item7"});
            dp.addItem({"label":"item8"});
            dp.addItem({"label":"item9"});
            dp.addItem({"label":"item10"});
            var list:List=new List();
            list.dataProvider=dp;

            actionBarOverflow = new Sprite();

            var actBar:ActionBar=new ActionBar();
            actBar.showTabsFirstOnBar(false);
            actBar.reserveActionSpace(true);
            actBar.backButton = null; 

            actBar.tabOverflowParent = actionBarOverflow;
            actBar.width=stage.stageWidth;
            actBar.showTabsFirstOnBar(false);
            actBar.addAction(new TabAction("TEST"));
            actBar.addAction(new TabAction("TEST2"));
            actBar.addAction(new Action("Test1"));
            actBar.addAction(new Action("Test2"));
            actBar.addAction(new Action("Test3"));

            var list2:List=new List();
            list2.dataProvider=dp;

            addChild(actionBarOverflow);
            addChild( content );
            content.addChild(list);
            content.addChild(list2);
            content.addChild(actBar);

            actBar.x=0;
            actBar.y=stage.stageHeight-actBar.height;

            list.width=list2.width=stage.stageWidth;
            list.x=list2.x=0;
            list.height=(stage.stageHeight-actBar.height)/2;
            list2.height=(stage.stageHeight-actBar.height)/2;
            list.y=0;
            list2.y=list.height;

            list.addEventListener(ContextMenuEvent.OPENING, contextOpening);

            var actionsForBar:Vector. = new Vector.;
            actionsForBar.push(new ActionBase("Action 1"));
            actionsForBar.push(new ActionBase("Action 2"));
            var actionset:ActionSet=new ActionSet(actionsForBar);
            var contextactions:Vector.=new Vector.();
            contextactions.push(actionset);

            var actionsForBar2:Vector. = new Vector.;
            actionsForBar2.push(new ActionBase("Action 3"));
            actionsForBar2.push(new ActionBase("Action 4"));
            var actionset2:ActionSet=new ActionSet(actionsForBar2);
            var contextactions2:Vector.=new Vector.();
            contextactions2.push(actionset2);

            list.contextActions=contextactions;
            list2.contextActions=contextactions2;

            actBar.addEventListener( DragEvent.DRAG_MOVE, onDragMove );
        }

        private function contextOpening(e:ContextMenuEvent):void{
            trace("CANCEL OPENING");
            e.preventDefault();
        }

        private function onDragMove( event:DragEvent ):void
        {
            slideX += event.deltaX;
            content.x = Math.round( slideX + stage.stageWidth );
        }
    }
}

Although strobejb could be a solution, it involves a lot of changes to my code at the moment, but I think I found a good solution.

Instead of dealing with ContextMenu I forget and override onLongPress extension from the list.

override protected function onLongPress (): void {}

}

And if I have to display the context menu I can make inside the method with:

showContextMenu()

Tags: BlackBerry Developers

Similar Questions

  • How can I change the order of the elements in the "open with" context menu?

    I'm working on XP Prof SP3 and to change the order of the "open with" context menu.

    I like to make the most of my photos, I crop them optimal detail using a specific program for this. This program, I can access by right clicking on the photo icon by pressing H, to open the framework "open with" menu and then I have to scroll down to 6th place.

    You can imagine that if you do this for a series of hundreds of vacation pictures, you are quickly tired.

    Is there a way how I can change the sort order in the "open with" context menu, because the removal of everything seems not a too good idea.

    Is there anyone out there who can help me?  I thank in advance.

    Michael

    I'm working on XP Prof SP3 and to change the order of the "open with" context menu.

    I like to make the most of my photos, I crop them optimal detail using a specific program for this. This program, I can access by right clicking on the photo icon by pressing H, to open the framework "open with" menu and then I have to scroll down to 6th place.

    You can imagine that if you do this for a series of hundreds of vacation pictures, you are quickly tired.

    Is there a way how I can change the sort order in the "open with" context menu, because the removal of everything seems not a too good idea.

    Is there anyone out there who can help me?  I thank in advance.

    Michael

    This utility is supposed to do what you want, but I have not personally tried:http://www.lopesoft.com/en/fmtools/info.html

  • How to open the context menu programmatically?

    I'm sure I'm missing something very elementary, but my eyes are listening on after a lot of research.

    I have a set ListField implemented that replaces getContextMenu() and creates a custom context menu.

    I also override trackwheelClick() to intercept clicks when it's to the point. I would like a click wheel to simply open the context menu, but I can't understand how to simulate pressing the menu button.

    Thank you!

    crush makeMenu instead, you can only manage a better

  • How do you screen captures a context menu?

    In Windows XP, I was able to hold the print screen key down while I was open a context menu and then press Alt to capture the screen with the context menu in the Clipboard.  Now I can't do that work (using Windows 7 64-bit) and cannot do the same with the cutting tool, as far as I can tell.  Any guidance would be appreciated.  I read the thread on the print screen key does not as it used and I agree - I did find the magic combination to make it work at all (I tried Control, Alt, function and various combinations without success.)

    --E

    Ah, I found it (at least on my Dell Latitude E6510).  The magic combination is the first F-lock (Fn + F5), and then FN + F11 (Prnt Scrn).

  • Choose the program by default, open with context menu right-click on a program does not!

    When I right click on an application such as a text document and try to change its default program (right click, open with, choose the program by default) I get an error says: "this file has no program associated with it for performing this action. Please install a program or, if such is already installed, create an association in the default programs control panel. »
    There is no problem to open the application, but the problem is the button ONLY!
    Fix association .exe, .txt, etc. did nothing!
    You can see my thread on SevenForums here: http://www.sevenforums.com/performance-maintenance/221020-choose-default-program-button-right-click-not-working.html
    and this problem as my problem: http://superuser.com/questions/69193/choose-default-program-does-not-work-is-broken-on-windows

    Thank you!

    Problem solved by a person post in the Forums of Vista, that what he said in this thread (Thread link: http://www.vistax64.com/general-discussion/202928-open-choose-default-program-error-vista-2.html#post939031 ):

    "PROBLEM SOLVED!"
    HOO HOO!

    I want to thank you once again BRINK for ideas on how to solve this problem.
    The next step below, this is how I solved this annoying problem:

    First of all, I came across this article on the Microsoft Web site by changing my google search to solve the problem. I started the google search with the following:

    'open with' lack of context menu

    Who brought results with the first being a microsoft link:

    Command 'Open with' missing from the context Menu

    Now the article didn't tell me exactly how to solve this problem, but it gave me an idea.
    He said look at the following reg key:

    HKEY_CLASSES_ROOT\Unknown\shell\openas\command

    And he said to watch the following default value:

    C:\%windir%\rundll32.exe shell32.dll, OpenAs_RunDLL %1

    After that, I noticed that the value was different, but then I noticed in watching the article says that this applies to Windows 95 and 98.
    I then looked at the same key on my laptop that is running Vista Ultimate 32 bit also and I noticed there are subfolders on my laptop that my office did not have.
    It should look like the following:

    HKEY_CLASSES_ROOT\Unknown
    \DefaultIcon
    \+Shell
    \+openas
    \COMMAND
    \+opendlg
    \COMMAND

    My office was only the DefaultIcon folder.
    Well I just copied the key from my laptop and voila... it worked.
    I thank the gods of the computer. This has really been bugging me. I know that some people would have just reconfigured or installed a new but I knew it was an easy fix. I thought it was a reg key or windows dll file, but I just need to find the location where he resided in. Luckily I came across this article which pointed me in the right direction. Now I feel like I accomplished something.

    Sorry if this is a bit long but I HATE it when I'm looking for answers in the forums and I see someone say they have solved their problem, but they either don't say anything about how they fixed or that they are so vague that they could didn't say anything.
    I hope this helps others if they have this problem.

    Thank you once again on BOARD! "

    That's all!

  • delete e-mail messages from context menu

    I am running Windows 7 Home Premeum 64-bit with service pack 1.

    I'm trying to delete e-mail messages from the context menu when right clicking on an image.

    I have AT & T Yahoo! as my e-mail provider that is NOT an option available to Windows, so I can't use the option of e-mail anyway.

    Given the unusable option is distracting and often gets clicked by mistake while trying to save an image to disk.

    Please let me know how to solve this problem.

    Thank you... Alan

    Add the e-mail account to livemail,

    http://Windows.Microsoft.com/en-us/Windows-Live/Mail-add-email-account-FAQ

  • Make a right click on the e-mail list no longer opens the context menu.

    Hello world
    Thunderbird collapsed to display the context menu on the mailing list recently. Make a right-click displays just the cross line. What is the problem could be?
    Thanks anyone for any help.

    Win 8.1 64
    Thun 31.3.0

    Very strange.
    Make a right click on the email list should open a menu drop-down.
    Usually a line crossed through something means that it is marked as deleted in an imap e-mail account.

    See if there is a conflict with an add-on.
    Restart Thunderbird in safe mode.
    Help > restart with disabled addons.

    then run the same test; Right click on the email list.
    Do you get the drop down, if so, then one of your addons is the origin of the conflict.
    You'd have to disbale each in turn to find what the problem is.
    Maybe the addon should update.
    Report on the results.

  • From context menu navigation arrows

    I've recently updated to Firefox 32 and really the new nav buttons on the shortcut menu. However, forward and backward arrows stopped some time today, appears in the context menu for all pages. Now the top of the context menu has just reload them and bookmark icons. How do I bring back arrows navigation?

    Have you tried to close and restart Firefox?

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe
  • Call attachedobject from context menu

    Dear developers

    When I press an action in the contextmenu in my list, I want to open a sheet that is attached to my page. But when I try that, he repeated to me that it can not find this sheet. Is it correct to say that the contextmenu knows only the element where it is defined in? I thought that my call might be spread until he found, but this isn't what he does.

    I need that attachedobject also in my page, is not possible to define it in the same element that where my context menu is defined in.

    Thanks in advance

    ListItemComponents have their own field of visibility. This thread has a similar problem and workaround:

    http://supportforums.BlackBerry.com/T5/Cascades-development/ActionItem-issue-in-a-context-menu/m-p/2...

    It is also possible to use this hack to keep a global pointer to the page:

    http://supportforums.BlackBerry.com/T5/Cascades-development/variable-object-visibility-in-ListViewIt...

  • two 'Adobe Reader' menu items in "Open with" context menu

    Is there a simple remedy to the problem of multiple occurrences of "Adobe Reader" in the context menu?

    In other words, in the Finder, Mac OS 10.6.8 I see two instances of "Adobe Reader" in the menu "open with...". »...

    Thank you in advance.

    lsregister - kill - r-domain local - domain-domain user system

    That did the trick for my particular situation.

    The "lsregister" program is part of the CoreServices framework in Snow Leopard.

  • How to add commands to the context menu for the types of files (add associations)?

    I would like to download anime and re - encode standard dvd (mpeg2) format before you burn it to a DVD for better quality.  I have a program suite that supports the grunt work, but to do a contextual menu command that calls the original batch file that the user must manually add it to the menu of context by file association.  I found that I can access the menus of file associations, but the option to add a new association with an existing file type does not seem to exist.  Is there a registry entry, I need to change or add to allow me to customize my context menus in Windows 7?

    Create a text file (make sure you have the framework where you DO NOT hide known file extensions unmarked)

    Change the new text file... Copy the following: [quote]

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.AVI\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.AVI\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.MP4\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.MP4\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [HKEY_CLASSES_ROOT\CCCP. WMP. AssocFile.MKV.1\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\CCCP. WMP. AssocFile.MKV.1\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [/ quote]

    Save the text file..., rename the text file with the .reg extension

    Double-click the new registry file to add the context menu commands to your registry... everything is done! :)

    And thank you very much, BluePlateSpecial!

  • Duplicate the application in the "open with" context menu

    Hi all

    On my iMac, the last OS X El Capitan.

    For an example, so I mediainfo application on the app store and it works fine, no problem.

    What happens if I go to a video rile, do a right-click, open with... There mediainfo twice, optionally including a version and the other a newer version if instead of upgrading to the new version of its kept the two versions?

    So I look under 'Applications' and that is only once not twice.

    I click and hold the icon for mediainfo in launchpad, it wiggles, I press x to delete it form party launchpad and its applications in the finder.

    But there must be somewhere because he is always right click on the menu 'Open with' and it actually load the program if you choose somehow even if it isn't the disk hard mac! ?.

    I did a search and don't see you mediainfo application anywhere on the disc hard mac.

    I have a copy of super duper of my HDD on an external hard drive that probably the application it but can it really be getting the external application and adding it to "open with" menu and launch the application from the external hard drive? If yes then this is not cool...

    I also noticed right on a PDF right-click, open with Watch 2 entrances of Safari 2 on iBooks, google chrome 2, all are an old version and one is a more recent version, where could he be getting from and the addition in the menu "open with?"

    If it is picking up my applications folder on the external drive backup and using that in the open with menu and launch the application from the external backup then it is really bad, it should only be launched from applications to disk hard mac shouldn't it?

    Any ideas?

    .

  • How can I get mail from the menu share

    I can't seem to be able to have "Mail" appear in the share menu in Safari. I use Mac, Version El Capitan 9.1.2. Someone at - it ideas?

    Thank you!

    The Mac backup.

    The Share button shows 'No. Service' or missing menu items?

    https://support.Apple.com/en-us/HT203129

  • How to remove the item from popup menu of refreshment

    I want to remove to get rid of my contraction that I always do some Office updates before anything else

    It cannot be deleted, it is hardcoded into the operating system (it is not a shell extension).

  • How to add (remove) items from the context Menu in Windows XP

    I want that some programs appear in the OPEN WITH context menu. This allows me to choose another in the associated program. I don't want to change the association, and I don't want to search the program folder programs whenever I need.
    morphingstar

    Right click on a file you want to modify the 'open with'.
    Click 'Open with' and "Choose program."
    Do not forget that you uncheck "Always use this program to open this type of file" except default if you want to use this program each time.

    Select the program you want to use, if it is not listed, then click Browse and navigate to the program. And then click OK.
    The new program now appears when you right click on the file or program.

    Please let us know if that helps.

Maybe you are looking for

  • Spam

    I keep getting emails that appear to come from Apple, send my bills and fees for music and apps that I have not bought. Is this a spam? It happened for about 4 months, with a couple that runs through every month. Help appreciated, H

  • Apple Watch battery drain

    I just did the update of the OS last night.  Rebooted the phone twice.  I checked the dough while you are driving in the work.  I do not use the watch for the post or courier. In an hour of wear only, the battery was down 20%.  Any ideas?

  • Page updated Windows cannot load the

    Please help, I also get this problem, I ran across your solutions of http://social.answers.microsoft.com/Forums/en-US/vistawu/thread/8e6340e2-74b7-4950-a467-b9a3f02a0769?prof=required here and it seems still not solution.  I am running Vista Home Pre

  • My cursor keeps jumping and keep scrolling to display at the bottom of page

    My screen keeps scrolling to the bottom of the page. How can I correct this anomaly. I use XP.

  • Acer Aspire not start after cleaning the fan and re - paste.

    I need help, I cleaned up my Aspire 5750 was dust accumulated during the last 3 years, I dismounted, clean the fan, re-glued the CPU and put everything back carefully, when I turned on it, the rotations of the fan for a while, then turns off, gets ba