Search code examples
delphidelphi-xe2dockingdockpaneljvcl

define a page control as a jvcl dockserver.custom dock panel. is it possible?


enter image description hereI have a main form with a left panel and in the center of the form I have a page control..and I am trying to dock other forms on the page control, as I have seen on an example made by Alister Christie; the thing is that the dragging of forms into the pagecontrol is lazy; I've discovered that a JVCL dockserver and a JVCL dockclient will help me with this.. the thing is that I want to assign pagecontrol to JVCL dockserver as a custom dock panel, but i don't know how to do it: here is the code i wrote on the oncreate event of mainform

procedure Tform1.FormCreate(Sender: TObject);  
begin  
  jvdockserver1.CustomDockPanel := jvpagecontrol1;  
end;  

could you please help me out? Forgot to mention that I am a kind of a novice in programmning and I am using Delphi XE2;


Solution

  • The JVCL Docking server component can only accept a PANEL as a docking location, either one of the built in ones, or a custom TPanel that you place on your form at designtime. However the Jedi Docking library will create page controls for you if you want it to. However, it has to be the one that manages them, because those controls could get moved (by you or by some other jvdocking code).

    So, if you want to have some tabs visible, you should not try to use your own page control, instead you should use the Docking In Code Demo as your sample, which comes with the JVCL, in the folder jvcl\examples\JvDocking\DockingInCode.

    Here is what the tabs look like that the JvDocking system makes for you, using the CustomDockPanel where the custom dock panel is attached to a TPanel, and then JvDocking "creates a page control" automatically for you when you need it:

    enter image description here

    Note that the pages are created or destroyed by the docking system, and the underlying work of managing the tabs is done by the JvDocking library, not by you.

    The main thing you need to do is use this code from MainFm.pas:

    tabHost := ManualTabDock( ctrl, newDocFm1,  newDocFm2);