#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    3

    Automatic show of Form after Create it


    I'm making maintenance in a legacy application. In some place a Form is created(e.g., the Create method is called) and the form is created and showed without explicit call to Show method.

    I try to modify certains properties of the Form but I can't discover what's happening and/or change this Form behaviour.

    I would never see this type of form usage.

    Could someone explain me wht's happening here?

    Greetings from São Paulo - Brazil

    Ricardo
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Augsburg Germany
    Posts
    12
    Rep Power
    0
    Forms have a visible Property.
    If a Form is a MDIChild this property is set to true and can't be changed to false.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    3
    Some questions:
    1. If this is the reason, why events On Show e OnActivate occur before que call to Create on the MDIParent form ends?

    2. I try to change the FormStyle property of the child form to fsMDIForm, fsNormal and fsStayOnTop and the described form behaviour doesn't change anyway...

    Cheers

    Ricardo
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Augsburg Germany
    Posts
    12
    Rep Power
    0
    I'm not sure if I understood you right. Do you mean
    [delphi]
    Tform4.Create(self);
    Showmessage('After call');


    procedure TForm4.FormCreate(Sender: TObject);
    begin
    Showmessage('Create')
    end;

    procedure TForm4.FormShow(Sender: TObject);
    begin
    Showmessage('Show')
    end;

    [/delphi]


    "After call" will be shown last.
    If you need a MDICHild you have no Option ... you have to find to place your required code.
    If you won't need MDIChild, just change Formstyle to normal, uncheck visible and remove it from automatic creation in your project.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    São Paulo - Brazil
    Posts
    35
    Rep Power
    3
    Hi Bummi!

    You catch the idea and solve my doubts about this matter.

    Cheers

    Ricardo

IMN logo majestic logo threadwatch logo seochat tools logo