Print Page | Close Window

ShortcutBar with a DockingPane

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Shortcut Bar
Forum Description: Topics Related to Codejock Shortcut Bar
URL: http://forum.codejock.com/forum_posts.asp?TID=19872
Printed Date: 03 December 2024 at 12:25pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ShortcutBar with a DockingPane
Posted By: alt
Subject: ShortcutBar with a DockingPane
Date Posted: 18 June 2012 at 4:22am
Hello,
 
I'm trying to add a docking pane and a shortcut bar in the docking pane on a Win32 dialog. I can add the docking pane and create a pane. But when I'm trying to add the shortcut bar in my pane... Nothing happens. Any help, suggestion, solution will be really appreciated.
 
Here the relevant code (translated to c#) :
 
 
// Create and initialize the docking pane
// The docking pane and the panes are correctly display on the win32 dialog
this.dockingPane = new AxDockingPane();
this.dockingPane.CreateControl();
this.dockingPane.AttachToWindow((int)this.Handle());
this.dockingPane.SetCommandBars(this.commandBars.GetDispatch());
 
// Create our left and 2 right panes - works ok
this.paneFuncsLib = this.dockingPane.CreatePane(AntiguaVODefines.PKL_DP_FUNCSLIB_ID, 300, 500, DockingDirection.DockLeftOf);
this.paneScheduler = this.dockingPane.CreatePane(AntiguaVODefines.PKL_DP_SCHEDULER_ID, 300, 500, DockingDirection.DockRightOf);
this.paneTipDay = this.dockingPane.CreatePane(AntiguaVODefines.PKL_DP_TIPDAY_ID, 300, 500, DockingDirection.DockRightOf);
 
// Create and initialize the shortcut bar
this.shortcutBarFuncsLib = new AxShortcutBar();
this.shortcutBarFuncsLib.CreateControl();
 
// Create one of our Win32 form that SHOULD be displayed in the shortcutbar
this.funcsLibFolders = new FuncsLibFolders(this, nullValue);
hWnd = (int)this.funcsLibFolders.Handle();
 
// Add a shortcut bar item and bind it to the form
this.shortcutBarItemFolders = this.shortcutBarFuncsLib.AddItem(AntiguaVODefines.PKL_SCB_FOLDERS_ID, "Caption",  hWnd);
this.shortcutBarItemFolders.IconId = PKLClassesDefines.PKL_ICO_DOSSIERS_ID;
 
// here we add several other panes the same way -> add item, hwnd
// try to show the shortcutbar, this doesn't work
this.shortcutBarFuncsLib.Show();
 
// try to assign the shortcut bar to the pane on left -> doesn't work but for other pane that doesn't contains shortcut bar
// but contains Win32 dialog, docking pane and pane are working ok
this.paneFuncsLib.SetHandle(this.shortcutBarFuncsLib.hWnd);



Replies:
Posted By: alt
Date Posted: 19 June 2012 at 11:06am
Ok guys,

I've gone a step further with this problem.

I've made a lot of tests trying adding the shortcut bar in the pane in several different ways.

What I've noticed, is that the handle of the shortcut bar is always 0. 

The only way I've found to have the handle of the shortcut bar set properly is when I add it on a Windows Form:

// This line initialize the Handle of the shortcut bar
this.Controls.Add(this.shortcutBar)

According the MSDN documentation, to force the creation of the handle for a control, it's enough to acces the Handle property of the control:

// This SHOULD initialize the handle of the shortcut bar
IntPtr tempHandle = this.shortcutBar.Handle

However, when accessing the property the handle still equals zero.


What I've done as a workaround is a class inheriting from the shortcut bar and in this class I use a container form where I'm adding the shortcut bar but I was thinking 
that there certainly is another way to set the handle for the shortcut bar? No?





Posted By: alt
Date Posted: 21 June 2012 at 10:35am

Hi again, 

I've a similar problem with the shortcut caption as the one with the shortcutbar described here.

What I'm trying to do is to add a shortcut caption onto a window where I can't use the method : this.Controls.Add(shortcutCaption), doing this my shortcut caption never gets a handles value as for the shortcut bar.

So I've subclassed the shortcut caption and I add it to a .Net user control that I manage only internally in the subclassed class. Here some code:

public class CJXSPShortcutCaption : AxShortcutCaption
    {
        private UserControl containerUserControl = null;

        public CJXSPShortcutCaption()
        {
            this.BeginInit();
            containerUserControl = new UserControl();
            containerUserControl.BackColor = Color.Red;
            containerUserControl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
            containerUserControl.Controls.Add(this);
            this.EndInit();
        }

        public new IntPtr Handle
        {
            get
            {
                return  base.Handle;
            }
        }
    }


Next I'm pinvoking SetParent to tell to my custom shortcut caption who is his parent.


This works but I've refresh problem. For example, when I'm resizing only the height of the window, the new size is set correctly but when I'm resizing only the width of the window, the new size is not set correctly (it keeps smaller).

So, can you help me, by explaining me how to add a shortcut caption onto a window without having to use the "this.Controls.Add(shortcutCaption)" method?

Thank you in advance




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