UIElement questions

Topics: CAB & Smart Client Software Factory
Feb 8, 2006 at 9:44 AM
originally posted by: PeterThomas

I have a shell that has several controls that I would like modules to have access to. Standard things like status bars, progress bars, and menus. There is a default adapter for menu items but not for a progress bar or one that can change the text of a status label. I could write my own adapter but the adapter interface only has Add and Remove methods. I need more flexibility then that. For the progress bar, I need a way to set the max tick amount, a way to increment it, and a way to reset it. For the status bar label, I need to change the text of an existing item. How should I go about this? What pattern should modules generally use for interacting with the shells controls? I need something more flexible then Add and Remove. I'm assuming for now that I'm just off base and there is some obvious answer I'm unaware of.
Feb 8, 2006 at 3:31 PM
originally posted by: jburkholder

I don't know how other people are doing this but we used Event Broker and added events to our custom shell. We then created a Base Workitem class that has protected methods to update UI elements in the shell like the Form caption and a Statusbar.
Feb 8, 2006 at 4:33 PM
originally posted by: PeterThomas

Okay, I can do that. This seems like a weak point in the CAB. Registering UIElements seems to have little use beyond adding and removing menu items. The docs make it sound like registering UIElements is how modules interact with the shell UI but it just doesn't seem capable of that sort of functionality to me.

Thanks for your response.
Feb 10, 2006 at 1:16 PM
originally posted by: jdressel

In prior releases of the CAB... if you followed the releases, there was a concept of UIElementManager. This was replaced with the UIElementAdapter concept we see today. The former 'manager' concept had methods that you describe to access the elements once you've Added them to the Adapter.
A suggestion could be to extend the IUIElementAdapter with your own IAccessableUIElementAdapter with Get() for starter and maybe Disable, Enable, Show, Hide... whatever. To access, you'll likely need a key... that's another story.

You could also extend the UIExtensionSite in a similar manner. I think I'd prefer this option. I like the fact that the UIExtensionSiteCollection provide hierarchical navigation and the UIElements you add are scoped to the workitem, but the concern we've had - and as you have mentioned, how can you GET (not extend) a shareable element in the hierarchy your workitem didn't add (extend)?

We're in the process of extending the UIExtensionSite API with Add<TElement>(TElement uiElement, string key) and Get(string key). By making keys 'public' for those shell items we wish to share (ie. Progress UIElement on the statusbar), one can interate the extensionsites hierarchy looking for the sharable element.