I’ve created an application which consists of a MainForm and several MDIChild Forms. I’m using AdvDockPanel and AdvToolbar from TMS’ components. My main form has AdvDockPanels on Top, Bottom, Left and Right side of the Form to display AdvToolbars.
Each MDIChild Forms contains an AdvToolbar and at creation of theses forms the AdvToolbar.Parent is set to the AdvDockPanel on the MainForm. At first, the AdvToolbar.Visible is False and on activation of each MDIChild Form I’m setting it’s visibilty to True.
To sum up, on activation of an MDIChild Form I want it’s AdvToolbar to be displayed on MainForm.AdvDockPanel and on deactivation of it I want it to hide.
This all works fine except when I try to drag an AdvToolbar from one AdvDockPanel to an other will crossing the middle of my MainForm which makes my active MDIChild form hidden and that causes this error: “Cannot change Visible in OnShow or OnHide”.
I’ve debugged it and found where this Exception is raised. It’s in Vcl.Forms.
procedure TCustomForm.CMShowingChanged(var Message: TMessage);
So, I’d like to know if there is a way to display the AdvToolbar from my active MDIChild Form on the MainForm while being able to drag my toolbar all around in my MainForm.
Thanks,
- Charles
You could check if the current parent of the toolbar is a TFloatingWindow (thats the parent when dragging the toolbar):
TAdvToolBar.Dragging doesn’t work because TAdvToolbar uses an own dragging flag FDraging but its not a property, so you could only access the variable if you modify the sourcecode of TMS Software.