Print Page | Close Window

MDI Window list

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14576
Printed Date: 22 November 2024 at 5:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MDI Window list
Posted By: rplp4
Subject: MDI Window list
Date Posted: 19 June 2009 at 1:19pm
Can anyone tell me where and how the open documents is added to the window list?
 
I am tring to make a MDI text editor.     I can not see how the window list is being updated.
 
I am using VB.net 2008


-------------
Product: Xtreme SuitePro (ActiveX) version 12.0.0
Platform: Vista (64bit) - SP 2
Language: Visual Basic 6.0



Replies:
Posted By: SuperMario
Date Posted: 21 June 2009 at 12:36pm
You simply add a command with ID XTP_ID_WINDOWLIST and the commandbars will keeps all open windows in the list for you.


Posted By: rplp4
Date Posted: 21 June 2009 at 1:51pm
This I have done, but it is only tracking the last opened window.   I am using vb.net 2008 on a 64bit system if this matters.
 
ControlPopup.CommandBar.Controls.Add(XtremeCommandBars.XTPControlType.xtpControlButton, CInt(XtremeCommandBars.XTPCommandBarsSpecialCommands.XTP_ID_WINDOWLIST), "Item 1", False, False)


-------------
Product: Xtreme SuitePro (ActiveX) version 12.0.0
Platform: Vista (64bit) - SP 2
Language: Visual Basic 6.0


Posted By: Xander75
Date Posted: 06 March 2014 at 10:17am
Hi...

Yeah I know this is 2014 and this post was originally posted in 2009, however this issue is still very well much alive!

So, I have decided to share my workaround to resolve this if anyone else stumbles upon this and has the same issue!!

This replaces the WINDOWLIST method supplied by Codejock as it would not corerctly show all forms.

PS. This solution is C#.Net, but it should be quite easy to convert over to VB.Net.

Note: The .IsNull() & .Includes() are my own extension methods. Simply convert this to:

e.commandBar.Parent != null

if (e.commandBar.Controls.Id != 1000 && e.commandBar.Controls.Id != 1001 && e.commandBar.Controls.Id != 1002)

The above id's are described below, I simply didn't wish to delete them when building the Window List.


private void CommandBars_Execute(object sender, AxXtremeCommandBars._DCommandBarsEvents_ExecuteEvent e)
{
    switch (e.control.Id)
    {
        ... // All your commandbar execution code goes above here

        default:
            // Activate the selected Window List Form.
            for (int i = 0; i < Workspace.ItemCount; i++)
            {
                if (Workspace.Item(i).Caption == e.control.Caption)
                {
                    Workspace.Item(i).Selected = true;
                    break;
                }
            }
            break;
    }
}

private void CommandBars_InitCommandsPopup(object sender, AxXtremeCommandBars._DCommandBarsEvents_InitCommandsPopupEvent e)
{
    // Build the Window List of Open Mdi Child Forms
    if (!e.commandBar.Parent.IsNull())
    {
        if (e.commandBar.Parent.Caption == "Window")
        {
            // Delete all menu's apart from Cascade, Arrange Horizontally & Arrange Vertically
            for (int i = e.commandBar.Controls.Count; i >= 1; i--)
            {
                if (!e.commandBar.Controls.Id.Includes(1000, 1001, 1002))
                    e.commandBar.Controls.Delete();
            }

            // Get the Active Mdi Child Form
            Form frmActiveForm = this.ActiveMdiChild;

            // Build the Open Window List
            int x = 1;
            foreach (Form frm in this.MdiChildren)
            {
                CommandBarControl ctrl = e.commandBar.Controls.Add(XTPControlType.xtpControlButton, x, frm.Text.Trim());
                ctrl.BeginGroup = (x == 1 ? true : false);
                ctrl.Checked = (frmActiveForm.Text == ctrl.Caption ? true : false);
                x++;
            }
        }
    }
}



-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net