pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: How to create menu for MenuButton dynamically
Date Fri, 24 Jun 2011 16:14:19 GMT
(continued just to dev list)

On 24 June 2011 22:32, Greg Brown <gk_brown@verizon.net> wrote:

> The MenuHandler interface is generic - it applies to all components and is
> provided as a convenience for configuring either:
> a) a component-specific context ("right-click") menu
> b) an application-wide frame menu bar
> I don't understand how "configureMenuButton()" would fit into that model.
> All components can have a context menu, and all components may be
> descendants of a frame that has a menu bar. However, components don't "have"
> a menu button, so it's not clear what menu button
> MenuHandler#configureMenuButton() would apply to, or when/how it would be
> triggered.
> Yes, I agree that it is not a fit to the model you describe although I
hadn't even it that before you mentioned it.  (And obviously hadn't picked
up on how MenuHandler fits into the grand scheme of things)

My point was that as Pivot consumers, both Edvin and myself looked at the
MenuHandler class, as its name suggested it might be used in conjunction
with a MenuButton somehow.  Combined with the knowledge that context menus
can be configured before they are displayed, I thought there would be an
equivalent mechanism *somewhere* for configuring the menu of a MenuButton
before it is displayed.

If I understand you correctly, I think what you are describing might be a
> new event or handler on MenuButton itself. For example, MenuButton could
> fire a "menu about to be shown" or "menu hidden" event that a caller could
> hook and use to populate/tear down the menu's contents.
> Yes, that is pretty much what I was describing, but only in an effort to
provide a dedicated means of configuring a context menu before it is
Context menu --> MenuHandler  (of course!)
MenuButton --> WindowStateListener (why do I have to be concerned that there
is a Window involved, when all I want to do is populate a menu?)  I
understand that this is not a big deal - I just thought there would be a
cleaner way.

However, the window open preview and window close events map well to this
> scenario, so I'm not sure how much value there would be in creating new
> events specifically for this purpose.
The idea of some kind of configureMenuButton() callback came up before the
proposed reintroduction of the previewWindowOpen stuff.  If the
previewWindowOpen goes ahead, then there would obviously be no need for an
additional event that essentially achieves the same thing.

However, if the previewWindowOpen event does not make a comeback (and I
assume it was removed for a reason), then some other event specifically for
the purpose of configuring a MenuButton could be possible, or even one
common to all components that 'pop up a Window'. A 'PopupStateListener' for
want of a better name.


> On Jun 24, 2011, at 11:19 AM, Chris Bartlett wrote:
> > I'll try rephrasing.
> >
> > Although I hadn't used MenuButtons before, I was aware of the MenuHandler
> interface.
> > As the name suggested it handled Menus, I thought it would define some
> kind of a configureMenuButton() method similar to configureMenuBar() and
> configureContextMenu().
> > This is purely based on the class names - MenuBar & MenuButton.
> >
> > My expectation was that *if* such a method existed, it would be used to
> configure the menu to be displayed by a MenuButton prior to the MenuButton's
> popup opening.
> >
> > *If* a MenuHandler implementation contained such a method, I would only
> expect that method to be executed in the above scenario, ie when that menu
> handler was set for a MenuButton instance.  It would simply be ignored for
> any other Components.
> >
> >
> > I just expected a callback similar to
> configureContextMenu/configureMenuBar to exist *somewhere*, and be designed
> for use in the scenario Edvin described.  Perhaps it would be defined in a
> MenuButton.Handler interface, but the generic 'MenuHandler' name suggested
> that would  be the obvious place to look.  Edvin mentioned early on in the
> thread that it was where he looked too.
> >
> > All of this derives from my take on the general consistency throughout
> Pivot.
> >
> > Chris
> >
> > On 24 June 2011 21:55, Greg Brown <gk_brown@verizon.net> wrote:
> > > When Edvin asked the question, my first thought was that MenuButton
> probably had setMenuHandler() method, and MenuHandler had a corresponding
> configureMenuButton() method.
> > >
> > > Following activation of the MenuButton, the configureMenuButton() would
> be called to populate the menu
> >
> > OK, but a menu button can be attached to any component. What would it do
> for non-MenuButton components?
> >
> >
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message