![]() |
MDI tabbed docs and multiple docs |
Post Reply ![]() |
Author | |
AndyL ![]() Newbie ![]() Joined: 07 November 2006 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() Posted: 08 November 2006 at 12:48pm |
I am writing an MDI application and using CJ CommandBars for the first time.
I would like to emulate the Visual Studio options of flicking from a "Tabbed documents" to"Multiple documents" representation of the Child forms.
I think that the logic that I need is as follows.
If "Multiple Doc mode" selected then identify each tab and pick up each form, turn each form FontBordersStyle to "sizeable", remove the tabs from the CommandBar and redisplay the forms as standard MDI Child windows and cascade them in the parent form.
If "Tabbed doc selected" then identify all the open forms, turn off their FontBorderStyle, add correct number of tabs to the commandbar and load each form onto the tab.
Being a Newbie to CJ I am not sure where to start. I have the "tabbed" look working OK. Can anyone advise on what objects and methods I should be using to attempt this?
If anyone can provide code snippets that would be greatly appreciated.
Thank you. Andy.
|
|
![]() |
|
AndyL ![]() Newbie ![]() Joined: 07 November 2006 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Well the task wasn't as simple as I expected. The main problem revolved around the clash between EnableGroups() and ShowTabWorkspace. I attach a variation of the c# sample "MDISample" with a menu option called "Show Document Tab". Selecting this will toggle tabbed view and multiple document view.
N.B. I cannot use EnableGroups() in this code - it stops ShowTabWorkspace from working.
The key code is in a helper function
#region Helper functions private void ChangeDocType(bool TabbedDocs) { m_TabbedDocs = TabbedDocs; if (m_TabbedDocs == true) //tabbed document display { m_Workspace = CommandBars.ShowTabWorkspace(true); m_Workspace.Refresh(); foreach (Form ctrl in this.MdiChildren) { ctrl.FormBorderStyle = FormBorderStyle.None; ctrl.WindowState = System.Windows.Forms.FormWindowState.Maximized; } foreach (XtremeCommandBars.TabControlItem tci in CommandBars.TabWorkspace) { //MessageBox.Show(tci.Caption + " : " + tci.Handle.ToString() + " : "); //need to loop through the tabs and select them so that the form is redisplayed correctly //in the tab. m_Workspace.FindItem(tci.Handle).Selected = true; } } else //multi document display { m_Workspace = CommandBars.ShowTabWorkspace(false); m_Workspace.Refresh(); foreach (Form ctrl in this.MdiChildren) { //making the form invisible and then visible makes sure that it is redrawn correctly. //N.B. make sure that the form is not set to AutoSize ctrl.Visible = false; ctrl.AutoSize = false; ctrl.FormBorderStyle = FormBorderStyle.Sizable; ctrl.StartPosition = FormStartPosition.CenterParent; ctrl.WindowState = System.Windows.Forms.FormWindowState.Normal; ctrl.Visible = true; } this.LayoutMdi(MdiLayout.Cascade); } } #endregion Hope this helps someone
|
|
![]() |
|
AndyL ![]() Newbie ![]() Joined: 07 November 2006 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Excuse the links to the upload file - I wondered where they had gone - ignore them from the code snippet
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |