Hi, all -
We are currently building an MDI-based app, and the MDI container's toolbar manager has tools for File menu, Window menu, etc. And then the MDI children add a couple of their own, which are document-specific - Edit menu is a good example.
But then we are loading custom controls into the MDI children, things that the main MDI container will have virtually no knowledge of. (That said, there are a couple of custom events that we use to communicate.) We load them based on application.settings keys and DLLs in the app's folder.
I would like to have available a custom menu (or menus), specific to each custom control. Ideally, the custom DLL would load, and any popup menus or toolbars that are specific to that control would show up in the main app's toolbar, alongside the file/edit/window menus - that is, merge them the way MDI children merge with their parents.
The best I've been able to do is make a floatable toolbar attached to the custom control, but of course it stays.. well.. attached to the control. I can't dock it at the top of the screen.
I had the idea of using a custom event to let the main app know when a control has been created or updated, and hand it the toolbars that I'd like merged in the main window, but it's getting uppity with me and telling me I can't insert the custom control's menus into the main window's toolbarmanager. The nerve...
So - is there any way for me to do this? If you need clarification, I'd be happy to make it happen...
Thanks!Rob Russell
KO.
Thanks, Mike. Sounds like I got my work cut out for me...
R
rprussell said:I was trying to do it w/out making copies. Can you give me the syntax for that? I've scanned the Tool methods for things like GetCopy or GetClone etc, but came up empty.
There is no way to accomplish this without making copies. There is no method on ToolBase to clone or copy the tool. This will need to be done manually by creating new tools of the same type and copying over any relevant properties.
rprussell said:My question if we go that route, then, is where do the events for this tool get handled? Can I still handle events from the copied tool in the embedded custom control? Or would I have to trap them in the MDI manager and pass them off somehow?
It depends where the tools are defined. If you take the approach where you add the tools to the child and call RefreshMerge(), the events will be fired on the child. If you add the tools to the parent, the events will be called don the parent. The events cannot be automatically routed to the custom control, you would need to manually trap them and pass them off. I would recommend giving the copied tool's keys a prefix or suffix which indicates which custom control the events should be routed to. The manager which initially handles the event could examine the tool's key for this prefix or suffix and pass it off to the corresponding custom control.
Hi, Mike -
I was trying to do it w/out making copies. Can you give me the syntax for that? I've scanned the Tool methods for things like GetCopy or GetClone etc, but came up empty.
My question if we go that route, then, is where do the events for this tool get handled? Can I still handle events from the copied tool in the embedded custom control? Or would I have to trap them in the MDI manager and pass them off somehow?
Rob
The toolbars manager does not support merging multiple child managers, but you can submit a feature request for this: http://devcenter.infragistics.com/Protected/RequestFeature.aspx.
Other than that, you would need to implement this manually. There are a few ways you could do this. You can recreate the menus and tools on the child toolbars manager, then call RefreshMerge() on either the parent or child managers to see those new tools in the merged parent manager. You could also recreate the menus and tools on the parent manager. It sounds like this is what you were trying to do when you were told you couldn't do it though. If you were trying to take the tools which exist in the custom control's manager and add them directly to one of the other managers, this is not supported. Tools can only exist in one manager. However, if you were creating copies, it should have worked. If it didn't, it could be a bug and I would recommend submitting it to the support group: http://ko.infragistics.com/gethelp.