Jump to content

UniForm as a separate tab in the main application


artem_niko

Recommended Posts

Good afternoon!
I'm interested in this.
Is it possible to make it so that UniForm could be made as a separate window, but without breaking away from MainForm?
Let me explain what I mean. 
Here in your browser there are tabs, and let's say you have connected a second monitor to your computer and want to display some tab, for example, from YouTube, on the second monitor. To do this, you just take the tab title and drag it to the second monitor and it works. Here, I need to be able to do this with the form.
Is this possible? 
I tried the UniMainModule.ConstrainForms, but it only turns out that I can move the form within the MainForm of the main project, and I would need to move the form outside of it.

Link to comment
Share on other sites

I do not know if this solution will ultimately be for you, but I solve a similar problem by running uniForm as pages in uniPageControl.

procedure TMainForm.RunTheFormAsPage(form_caption: string);
var
  Ts : TUniTabSheet;
  isShow : Boolean;
  i: Integer;
begin
 isShow:=False;
 if uniPageControl.PageCount>0 then
  Begin
   for i := 0 to uniPageControl.PageCount-1 do
    Begin
     if uniPageControl.Pages[i].Caption = form_caption then
      Begin
       isShow:=True;
       uniPageControl.ActivePage:=uniPageControl.Pages[i];
      End;
    End;
  End;

  if isShow=False then
  Begin
   Ts := TUniTabSheet.Create(Self);
   Ts.PageControl := uniPageControl;

   Ts.Closable  := True;
   Ts.Layout    := 'fit';
   Ts.Caption   := form_caption;
   Ts.AlignmentControl := uniAlignmentClient;

   uniForm.Parent:=Ts;
   uniForm.Show();
  End;
end;

It is also useful to remove border for this attached form.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...