Can we add any callback logic for the context menu show/peek and hide function? #740

Closed
xqliu opened this Issue Mar 4, 2013 · 11 comments

Projects

None yet

4 participants

@xqliu
xqliu commented Mar 4, 2013

I found that I would like to hook in some custom logic together with the show/peek and hide of context menu, if I put the code together with the show/peek invoke in my code, then the follow scenario happens

  1. When the context menu is hidden, user clicks on one of the image list item and it shows up, my custom logic is also invoked, that's what I expected.
  2. Then the user clicks on the screen again, then the context menu will be hidden, I also would like to run my custom logic, currently what I am doing is add the logic to bbui.js file, I know this is not a good way, do you know any kind of extendable way to do this?
  3. It would be good that we could have a mechanism to hook in our own logic into the context menu show/hide/peek.

Appreciate for any suggestion or information on this.

Regards.
Lawrence.

@tneil
Member
tneil commented Mar 4, 2013

Adding this for consideration in 0.9.6... we're working on a few context menu related items

@xqliu
xqliu commented Mar 4, 2013

Sounds great, thanks. Not sure whether the follow approach is ok1. Add two additional parameter to the peek and show method of context menu.  one is the callback for peek/show , another is the callback for hide. 2. Pass the data parameter of show/peek to the callback 3. Also pass the data parameter to the hide callback.  Sent from my BlackBerry 10 smartphone. From: Tim NeilSent: 2013年3月5日星期二HKST00时02分52秒To: blackberry/bbUI.jsReply To: blackberry/bbUI.jsCc: Lawrence LiuSubject: Re: [bbUI.js] Can we add any callback logic for the context menu show/peek and hide function? (#740)Adding this for consideration in 0.9.6... we're working on a few context menu related items

—Reply to this email directly or view it on GitHub.

@tneil
Member
tneil commented Mar 4, 2013

The context menu always has a selected property that will give you the element that is selected by the context menu if that is what you're looking for

@xqliu
xqliu commented Mar 4, 2013
                                                                                                                                 I would like to pass other parameters other than the build in ones.For example I would like to know the kind of object I am operation on, this information could not be get from the selected id. Thanks for your recall of the selected attribute Sent from my BlackBerry 10 smartphone.                                                                                                                                                                                                                           From: Tim NeilSent: 2013年3月5日星期二HKST02时39分23秒To: blackberry/bbUI.jsReply To: blackberry/bbUI.jsCc: Lawrence LiuSubject: Re: [bbUI.js] Can we add any callback logic for the context menu show/peek and hide function?  (#740)The context menu always has a selected property that will give you the element that is selected by the context menu if that is what you're looking for

—Reply to this email directly or view it on GitHub.

@tneil
Member
tneil commented Mar 4, 2013

It doesn't give the selected id.. it gives the selected DOM element. You can add any properties you like to your DOM element and then read them back off from the context menu selected property

@igorcosta

Implicitly logic over show()/hide() breaks apart the context Menu in behavior.
You can apply logic on your own custom code without branch over the method.

@tneil
Member
tneil commented Mar 11, 2013

Been looking at onshow/onhide events for the tab overflow menu for issue #724.. Possibly something similar for context menus would make sense too

@marchitos

I definitely need the show method back :) I want the ability to show the context menu in a custom list/view

@tneil
Member
tneil commented Mar 11, 2013

I've added issue #748 to track wiring context menus for custom controls.

@tneil
Member
tneil commented Mar 11, 2013

I think the key will be to be able to have an event that allows you to manage visibility of context menu items based on the item that was selected.

Maybe instead of a onshow/onhide we need simply an oncontextmenu event for the image lists that will pass in the selected list item that will allow you to manipulate the visibility of the context menu items before it is shown.

@tneil
Member
tneil commented Apr 29, 2013

I've added this as a requirement to issue #310 so I'll close this issue

@tneil tneil closed this Apr 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment