ShortcutBar with a DockingPane |
Post Reply |
Author | |
alt
Newbie Joined: 18 June 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
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); |
|
alt
Newbie Joined: 18 June 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
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? |
|
alt
Newbie Joined: 18 June 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
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 |
|
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 |