Jump to content

Is a sample demo showing interaction between a few forms


CCH4UNIGUI

Recommended Posts

2 minutes ago, CCH4UNIGUI said:

In Delphi, its trivial to call another form via a menu, button etc via a click event. 

I have taken a look at the AllFeatures demo, mdemo but cannot understand nor see how this is done.

Can anybody clarify.

Hello,

procedure TMainForm.NavTreeClick(Sender: TObject);
var
  Nd : TUniTreeNode;
  Ts : TUniTabSheet;
  FrC : TUniFrameClass;
  Fr : TUniFrame;
  FClassName, Path: string;
begin
  Path := UniServerModule.StartPath + 'units\';
  Nd := NavTree.Selected;
  if Nd.Count = 0 then
  begin
    Ts := Nd.Data;
    if not Assigned(Ts) then
    begin
      Ts := TUniTabSheet.Create(Self);
      Ts.PageControl := UniPageControl1;

      Ts.Closable := True;
      Ts.OnClose := TabSheetClose;
      Ts.Tag := NativeInt(Nd);
      Ts.Caption := Nd.Text;
      Ts.ImageIndex := Nd.ImageIndex;

      FClassName := 'TUni' + FileNames.Values[Nd.Text];

      FrC := TUniFrameClass(FindClass(FClassName));

      Fr := FrC.Create(Self);
      Fr.Align := alClient;
      Fr.Parent := Ts;

      Nd.Data := Ts;
    end;
    UniPageControl1.ActivePage := Ts;
  end;
end;

...

Link to comment
Share on other sites

12 minutes ago, Sherzod said:

Hello,


procedure TMainForm.NavTreeClick(Sender: TObject);
var
  Nd : TUniTreeNode;
  Ts : TUniTabSheet;
  FrC : TUniFrameClass;
  Fr : TUniFrame;
  FClassName, Path: string;
begin
  Path := UniServerModule.StartPath + 'units\';
  Nd := NavTree.Selected;
  if Nd.Count = 0 then
  begin
    Ts := Nd.Data;
    if not Assigned(Ts) then
    begin
      Ts := TUniTabSheet.Create(Self);
      Ts.PageControl := UniPageControl1;

      Ts.Closable := True;
      Ts.OnClose := TabSheetClose;
      Ts.Tag := NativeInt(Nd);
      Ts.Caption := Nd.Text;
      Ts.ImageIndex := Nd.ImageIndex;

      FClassName := 'TUni' + FileNames.Values[Nd.Text];

      FrC := TUniFrameClass(FindClass(FClassName));

      Fr := FrC.Create(Self);
      Fr.Align := alClient;
      Fr.Parent := Ts;

      Nd.Data := Ts;
    end;
    UniPageControl1.ActivePage := Ts;
  end;
end;

...

Hi Sherzod

Thanks for the speedy response :-)

Is there a much simpler example ?

Maybe a simple menu or button and upon clicking will launch another 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...