Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - MDI tabbed docs and multiple docs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MDI tabbed docs and multiple docs

 Post Reply Post Reply
Author
Message
AndyL View Drop Down
Newbie
Newbie


Joined: 07 November 2006
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyL Quote  Post ReplyReply Direct Link To This Post Topic: MDI tabbed docs and multiple docs
    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.
 
 
Back to Top
AndyL View Drop Down
Newbie
Newbie


Joined: 07 November 2006
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyL Quote  Post ReplyReply Direct Link To This Post Posted: 14 November 2006 at 3:38pm

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

Back to Top
AndyL View Drop Down
Newbie
Newbie


Joined: 07 November 2006
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyL Quote  Post ReplyReply Direct Link To This Post Posted: 14 November 2006 at 3:40pm
Excuse the links to the upload file - I wondered where they had gone - ignore them from the code snippet
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.