Re: Menubar unusable?
Ross Wetmore <[email protected]>
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Found the undocumented trick for menubars!
If you stare at the *Def and XulManager code
long enough, then it becomes apparent that ...
Unlike the Ramses example in which the
menubar is more a cosmetic showpiece, if
you want menubars to actually trigger
actions in your application, then you
need to create the menubar *after* you
have created your content and populated
the XulManager with the necessary
XActions - menubars are "thin" widgets
that do pure lookup with no real creation
abilities.
demo/menu/AppFrame.java:
// get toolbar
JToolBar toolBar = xul.createToolBar( Chrome.ToolBar.MAIN );
getContentPane().add( toolBar, BorderLayout.NORTH );
// get menubar
JMenuBar menuBar = xul.createMenuBar( Chrome.MenuBar.MAIN );
setJMenuBar( menuBar );
+ // Move this above the previous two if you actually want to
+ // have them attach to any XulActions this might define.
// get main content box
JComponent content = xul.createJComponentFromBox( Chrome.Box.CONTENT );
The fact that menubars are standalone
XUL elements that cannot be placed inside
other boxes should also be documented as
this appears to be a Luxor-specific
restriction.
Now if I can only find the hook to trigger
tabbox tab actions :-)
Cheers,
RossW
=====
Ross Wetmore wrote:
> I've been poking around the menubar and tabbox
> problem and am finding menubars to be rather
> useless or certainly obscure in operational
> mechanics of hooking them up to anything let
> alone tabbox panel operations.
>
> First, one gets Xul errors everytime one puts
> a menubar inside any other box, or vice versa.
> They really appear to be operational only as
> standalone elements. This is reinforced by the
> fact the any examples seem to create them with
> explicit code like this outside of any other
> component, i.e. in the static Main ...
> JMenuBar menuBar = xul.createMenuBar("mBar");
>
> The examples do not appear to show anything but
> the menu facade, or pure Xul effects, i.e. I have
> not seen a menubar example that actually invokes
> an Action or is updated by an Input.
>
> If you then create your component by subclassing
> XulForm or whatever, there seems to be no linkage
> between the XulInputs and XulActions of the two.
>
> This may boild down to the unanswered question
> about what are the defined Luxor scoping rules.
>
> But it looks like the LinkControls code in the
> Xul*Helpers really doesn't allow cross actions
> i.e. any action to be shared between two top
> level box-like objects.
>
> What am I missing?
>
> Cheers,
> RossW
> =====
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> luxor-xul-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luxor-xul-user
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf