Hi.
I need to enumerate through all controls on given form or usercontrol.
Generally, this is done by recursively iterating through controls property.
Now, I've got a form that has UltraToolbar on it. The Toolbar is not accessible directly via form.controls collection, but there are four dock area controls that can be accessed. For each one of them, controls collection is empty, i.e. neither one of them acts as regular container.
The question is what is the best way to access that toolbar?
Thanks Mike.....it helped alot!!!!
You can cast the ToolBase returned for the 'File' tool to a PopupMenuTool. This class has another Tools collection defined which contains the tools under the menu.
I have another question.
I've got a problem getting to all tools within the containing control.
There are bunch of PopUpMenu tools, some added at design time and some at the run-time.
It seems that I can only access top-level tools via the "tools" collection.
For example, I have "File" top-level item, with "Exit" under it.
I also have a "Styles" item, with bunch of styles selection options under it. I can access both "File" and "Styles" entries, but not the sub-menus.
It seems that I can't find the appropriate collection that contains sub-items.
Mike, thanks!
That was exactly my problem, I was wondering why the ToolbarsManager was accessible in designer but never appeared for intellisense.
Guess putting too much faith in intellisense is not that good idea :)
Each dock area will point back to the same UltraToolbarsManager. This is the object which contains the toolbars and tools. The dock area has a ToolbarsManager property to access its associated toolbars manager (I'm not sure why, but this property is actually hidden from intellisense, so you will not see it in the property list, but just type it out manually and it will compile). Once you have a reference to the toolbars manager, there is a Toolbars collection which you can iterate to get to each toolbar. Each UltraToolbar in the collection has a Tools collection which contains ToolBase-derived instances.