MenuItems

Topics: CAB & Smart Client Software Factory
Jun 23, 2005 at 11:53 AM
originally posted by: aaguiarz

Most applications have a set of hierarchical menu structures that apply to the current context.

These menues can be displayed with different widgets (MenuBar, Toolbar, Tree, Task pane, etc).

I want to be able to define my MenuItems without knowing which control is going to display them, so I defined a MenuEntry class, that has a key, name, bitmap, etc, and then built a UIMenuStripManager, UITaskPaneManager, UIExplorerBarManager, etc, which handle MenuEntry.

I had to make a couple of hacks, the most ugly one is that to be able to use the commands, I need a "Click" event in the MenuEntry, so I handle it there and delegate it to the underlying control.

I guess this will be a quite common scenario, so perhaps it requires more support inside the block itself..
Jun 23, 2005 at 12:27 PM
originally posted by: ptorrsmith

Can you post some of your code to demonstrate?

Thanks
Jun 24, 2005 at 7:12 PM
originally posted by: kzu_daniel_cazzulino

As usual, very interesting stuff Andres.

What you did is exactly what we expected people to do, so you can certainly notice that the block is not preventing that scenario ;).

That said, I've a suggestion: I'd modify your MenuEntry to just receive the event topic that it will fire when clicked. When you detect the click, you should just fire that topic through the IEventCatalogService. That way, the handlers can be methods annotated with the EventSubscription(...) attribute, and exist anywhere in the workitem.

Finally, we'd love to hear your feedback on the API, how it feels in general, what would you like to see improved, etc.