Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Strange 2 forms being displayed at same time...
Mon, Dec 12 2016 3:05 AMPermanent Link

Richard Mace

Hi,

I have a strange issue in that when my application is first run, it's actually showing both of the forms at the same time as per screen shot.

The Add button is the only visible control on the main form and the rest of the controls are all on a "User Properties" form that isn't being shown.

The only form that is auto created is the main form, and the User Properties form is created, a single time, in the main form's OnShow event, as per the following code:

 frmUserProperties := TfrmUserProperties.Create(nil);
 frmUserProperties.Hide;
 frmUserProperties.Parent := Self;

Any pointers as to what I am doing wrong?

Thanks

Richard



Attachments: 2xforms.png
Mon, Dec 12 2016 3:22 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

You might want to try creating the second form in the OnCreate event
rather that the OnShow otherwise it will get created each time the main
form is shown.

Chris Holland
[Team Elevate]

On 12/12/2016 08:05, Richard wrote:
> Hi,
>
> I have a strange issue in that when my application is first run, it's actually showing both of the forms at the same time as per screen shot.
>
> The Add button is the only visible control on the main form and the rest of the controls are all on a "User Properties" form that isn't being shown.
>
> The only form that is auto created is the main form, and the User Properties form is created, a single time, in the main form's OnShow event, as per the following code:
>
>   frmUserProperties := TfrmUserProperties.Create(nil);
>   frmUserProperties.Hide;
>   frmUserProperties.Parent := Self;
>
> Any pointers as to what I am doing wrong?
>
> Thanks
>
> Richard
>
Mon, Dec 12 2016 4:58 AMPermanent Link

Matthew Jones

Richard wrote:

> TfrmUserProperties.Create(nil);

I think that should be either the form, or the application, as the owner of the form, not nil.

Also, you hide it - why not have it hidden already?

--

Matthew Jones
Mon, Dec 12 2016 7:37 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

<< The only form that is auto created is the main form, and the User Properties form is created, a single time, in the main form's OnShow event, as per the following code:

 frmUserProperties := TfrmUserProperties.Create(nil);
 frmUserProperties.Hide;
 frmUserProperties.Parent := Self;

Any pointers as to what I am doing wrong? >>

Why are you creating the form in the OnShow event if you don't want it to be visible ?  Why not just wait until you need to create/show it ?

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Dec 12 2016 7:38 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Richard,

Also, are you intending to parent the form to the calling form ?

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Dec 13 2016 3:03 AMPermanent Link

Richard Mace

Thanks for everyone's replies.

I have fixed a couple of bugs in my code and re-arranged it slightly as per suggestions, and it all works well now.

Thanks

Richard
Image