Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

LMD-Dock and MDI.

Is it possible to have MDI as dock dkDocument type?



Comments

  • 7 Comments sorted by Votes Date Added
  • No. Its not possible.
  • Can you support this as a feature moving forward?
  • MDI is generally an outdated concept. We will not going to support it. But, can you tell us, why you need it at all?
  • I want to create a copy of an existing tab.

    Example 1.
    Notepad. create a new copied version of an existing tab. 
    Please tell me how to create a new tab of the same content?

    Example 2.
    Your LMD Dock demo. How would someone create a new tab?

    In d_MainFormUnit.pas, there is this - 

    function TfrmMain.CreateTextDoc: TLMDDockPanel;
    var
      memo: TMemo;
      s:    string;
    //  i: Integer;
    begin
      Result := TLMDDockPanel.Create(Self);
      try
        s := 'TextFile' + IntToStr(FNextDocId);
    //    for i := 0 to Random(10) do
    //      s := s + IntToStr(Random(10));
        s := s + '.txt';

        Result.Caption      := s;
        Result.ClientKind   := dkDocument;
        Result.OnClose      := DocClose;
        memo                := TMemo.Create(Result);
        memo.BorderStyle    := bsNone;
        memo.ScrollBars     := ssVertical;
        memo.ParentFont     := False;
        memo.Align          := alClient;
        memo.Parent         := Result;

        DockAsTabbedDoc(Result);
        Inc(FNextDocId);
      except
        Result.Free;
        raise;
      end;
    end;

      // creates tab's content manually which, should be what a MDI child should contain...
    end;

    Thoughts? Is there a way to pass a form instead of putting so much effort to make code?

    I have complex child window. What should I do?


  • Please tell me how to create a new tab of the same content?

    Just create a new dock-panel as shown in demo, dock it as you want and place a copy of your content inside it. Duplicating content is not related to docking at all. It's a general programming task, a part of your application.

    Is there a way to pass a form instead of putting so much effort to make code?

    Yes. Demo shows how to place a TMemo inside a panel. Similarly you can place any controls(s) including forms or frames.
  • hi,
    I want to use an existing DFM/PAS TForm inside the code. So how do I do so?


  • Just create an instance of your form (instead of shown in demo TMemo):

    var
      frm: TMyForm;
      s:   string;
    begin
      Result := TLMDDockPanel.Create(Self);
      try
        s := 'MyForm document';

        Result.Caption      := s;
        Result.ClientKind   := dkDocument;
        Result.OnClose      := DocClose;
        
        // TMyForm - is a class name of your form.

        frm        := TMyForm.Create(Result);
        frm.Align  := alClient;
        frm.Parent := Result;

        DockAsTabbedDoc(Result);
        Inc(FNextDocId);
      except
        Result.Free;
        raise;
      end;
    end;
Sign In or Register to comment.