Re: Generating GUI at run time

<[email protected]> Tue, 07 Sep 2004 09:16:50 +0200
Newsgroups gmane.comp.embedded.carlsbad-cubes
Organization http://freemail.web.de/
Message-ID <[email protected]>
List for Users of Carlsbad Cubes' Technologies and Products schrieb am 06.09.04 22:21:45:
> 
> Question for you guys. At runtime, how do you handle
> the ordering of menu items and menus? Meaning, if I
> want a File->New added to the top of the menu, but my
> code runs after the File menu is created by some other
> code, how do I dynamically ensure my File New is at
> the top, and how does different bits of code "fight"
> for the top/bottom positions. Ideally you want File ->
> Exit in its own separated area at the very bottom. But
> if some other code runs after mine does and adds a
> menu item to the File menu, it's most likely going to
> show up at the end.

There is no code changing the order of menu items. The
items appear exact in the order mentioned in your xml.
Also, there is a <separator/> tag to "draw a line"
between distinct menu items in the same menu. E.g.
if you want to separate the "Exit" menu from other items.


> 
> Also, is there any support for dynamic menus, by this
> I mean, it shows only the most used/priority items,
> with a little down button at the end to expand the
> menu and show all items? Like how MS Word/Outlook and
> some other apps work? If so, how are these defined
> dynamically so that some items show up in the
> shortened menu popup, and some show up only when the
> full menu is shown.

No, this you have to code yourself. You may of course
let swixml help you by getting the menu items and calling
setVisible(false) -- I did not try this, though.

> 
> Lastly, how do you handle context menu items/buttons?
> By this I mean, if I have an editor program with a
> pane on the left with a tree view showing the files,
> and on the right an editor. Now, assuming I have a
> node selected on the left AND in the editor I have
> text selected. The Edit -> Cut/Copy/Delete items as
> well as toolbar buttons are going to work on only ONE
> of the selected items. So if you have both selected,
> which one gets deleted? In other words, how do you get
> the delete button in the toolbar to delete the tree
> node selected OR the editor selected at runtime? Is
> there any way to do this?

This is a pure java issue and has little to do with swixml.
Some subjects regarding this are: test which component
owns the focus. Also, you may (as I would do it) create
a Cut/Copy/DeleteAction and register this component as
TreeSelectionListener of the tree and CaretListener of
your text (not sure about this). Then you could remember
the "last selected thing" allthough a test for the focus is
IMHO necessary too...

Frank

> 
> Thanks.
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> 
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com