Recent

Author Topic: ChildForm  (Read 4090 times)

josflix

  • Newbie
  • Posts: 1
ChildForm
« on: March 26, 2010, 04:12:15 am »
I'm new in Lazarus. How I know if a childform (my TForm2 with FormStyle:fsMDIChilForm) was created? I've got the next code:

Code: [Select]
procedure TForm1.MenuItem12Click(Sender: TObject);
begin
  {Creamos nuevo formulario hijo}
  With TForm2.Create(self) Do
       begin
       Inc(contador);
       Caption:='Nuevo' + IntTostr(Contador);
       Show();
       end;
end;         

Now, I want to Know if TForm2 was created. :o

davesimplewear

  • Sr. Member
  • ****
  • Posts: 321
    • Davids Freeware
Re: ChildForm
« Reply #1 on: March 26, 2010, 06:26:19 am »
AFAIK mdi has been discontinued in lazarus, this can be simulated to some extent by using a pagecontrol or note book and dynamically creating the page as shown in the psuedo code.

Code: [Select]
procedure TfMain.newEditMemo(aName: string);
begin
 Screen.Cursor := crHourGlass;
   try
   //create tabsheet to hold the memo and gutter, assign to the page control
   newTabsheet := TTabSheet.Create(pcEditor);
   newTabsheet.Parent := pcEditor;
   newTabsheet.Caption := aName;
   //newTabsheet.Hint := Name;
   fMain.ParentShowHint := False;
   fMain.ShowHint := False;
   fMain.Caption := MainCaption + newTabsheet.Caption;
   newTabsheet.ImageIndex := 0;
   newTabsheet.ShowHint := False;
   newTabsheet.ParentShowHint := False;
   newTabsheet.PageControl := pcEditor;
   pcEditor.ActivePage := newTabsheet;
   pcEditor.ParentShowHint := False;
   // create Memo and align, set Properties
   newMemo := TSynMemo.Create(newTabsheet);
   newMemo.Parent := newTabsheet;
   newMemo.Align := alClient;
   newMemo.WantTabs := True;
   newMemo.HideSelection := True;
   newMemo.OnChange := @newMemoChange;
   newMemo.OnDragDrop := @NewMemoDragDrop;
   newMemo.OnDragOver := @NewMemoDragOver;
   newMemo.ParentShowHint := False;
   newMemo.ShowHint := False;
   newMemo.PopupMenu := puEditor;
         {If Not Assigned(newMemo.Highlighter) Then
            newMemo.Highlighter := URLS; }
   autoComp.Editor := newMemo;
   setFonts.SynMemo := newMemo;
   //TextSetup;
   ActiveControl := newMemo;
   newMemo.Modified := False;
   finally
   Screen.Cursor := crDefault;
   setFonts.ReadSMemoFonts;
   end;
end;

Regards
Dave
All things considered insanity seems the best option

 

TinyPortal © 2005-2018