Open files displayed by tabs?

36 views
Skip to first unread message

Colin Cren

unread,
Nov 26, 2014, 2:10:36 PM11/26/14
to authoring-to...@googlegroups.com
Is there currently a UI component that keeps the open files in the DocumentRegistry selectable by tabs ala visual studio?

Ron2

unread,
Nov 26, 2014, 3:46:22 PM11/26/14
to authoring-to...@googlegroups.com
Hi Colin,

TabbedControlSelector is the MEF component that implements that functionality of letting the user press ctrl+tab and shift+ctrl+tab to switch between tabbed panels in a group of panels. Just drop it into your TypeCatalog. Many of our sample apps use it.

TabbedControlSelector switches between panels in the currently active docked (not floating) group of panels. It could use some improvements, like working with a floating group of panels, or maybe having the option of working just with documents. It lists other available dock groups, but doesn't let you select them. Also, the dialog box it uses, TabbedControlSelectorDialog, can't be customized currently. If you find you need to make modifications, maybe you can do so in a way that benefits others. But hopefully it's good enough for a first-pass.

--Ron

Colin Cren

unread,
Dec 2, 2014, 6:46:14 PM12/2/14
to authoring-to...@googlegroups.com
I wasn't thinking about ctrl+tab between tabs in a pane, but specifically about creating tabs per open document.

Ron2

unread,
Dec 2, 2014, 8:57:35 PM12/2/14
to authoring-to...@googlegroups.com
Ahh, I think I understand your question now.

ControlHostService is the component that makes the tabbed windows for you. You register WinForms Controls with it and they appear in the docking framework. You will probably want to create an Editor class that is a MEF component and that registers these document-editing Controls with ControlHostService. Your Editor class should implement both IDocumentClient and IControlHostClient. The Editor class is what associates a particular view of a document (like a circuit-editing Windows Control) with a particular physical document that might be stored in-memory as a DomNode tree. The Editor class also sets the current context (like a selection context) to correspond to the currently selected tabbed Control, when ControlHostService tells the Editor (via IControlHostClient) that one of the Editor's Controls has been activated by the user. Setting the current context correctly lets other editors, like the property editor, work with the most recently activated document.

I think it will become clear if you look at the Circuit Editor sample app and its Editor class, and then see how IDocumentClient and IControlHostClient are implemented. Almost all of our sample apps have an Editor class. (It doesn't have to be named Editor, of course, but that's just the convention we follow.)

Reply all
Reply to author
Forward
0 new messages