Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Form ClientWidth
Fri, Sep 21 2012 11:29 AMPermanent Link

Eric Schwarz

Avatar

I get the following if I try to access the form's clientwidth or height:

frmmain_fmmain.tcontainercontrol_fclientwidth is null or not an object

By the way, it's really annoying that I can't cut and paste from the error dialog. Smile

Eric Schwarz
Mon, Sep 24 2012 12:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eric,

<< I get the following if I try to access the form's clientwidth or height:

frmmain_fmmain.tcontainercontrol_fclientwidth is null or not an object >>

When/where are you trying to access the client width ?  If I try it here in
a button click handler, it works fine.

<< By the way, it's really annoying that I can't cut and paste from the
error dialog. Smile>>

The IE embedded web browser does some really funky stuff with controls when
you enable certain functionality, so for now it has to stay disabled.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 24 2012 1:19 PMPermanent Link

Eric Schwarz

Avatar


I was trying to alter the size of a panel (normally hidden/zero height) based on a button click.  I was calculating the size of a panel and a grid so they would both fit in the client area after the panel was "opened".  Unfortunately, I've since removed the offending code having moved on to some other experiments with my new "toy". Smile

---
Eric Schwarz
Mon, Sep 24 2012 2:01 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eric,

<< I was trying to alter the size of a panel (normally hidden/zero height)
based on a button click.  I was calculating the size of a panel and a grid
so they would both fit in the client area after the panel was "opened".
Unfortunately, I've since removed the offending code having moved on to some
other experiments with my new "toy". Smile>>

No problem - if you see anything like this again, please let me know.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 24 2012 3:51 PMPermanent Link

Eric Schwarz

Avatar

Just got this kind of thing again.  I'm setting Left and Top of the main form in OnCreate.  Works ok in OnShow.

---
Eric Schwarz
Wed, Sep 26 2012 3:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eric,

<< Just got this kind of thing again.  I'm setting Left and Top of the main
form in OnCreate.  Works ok in OnShow. >>

Can you send me a project that demonstrates the problem ?  I just want to
make sure that I'm getting everything exactly right.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 26 2012 7:03 PMPermanent Link

Eric Schwarz

Avatar

All I did was create a new project, Add a line "Form1.Left := 100;" in the OnCreate event.  Works ok in the OnShow event.  Verified it just now.  Although the test is slightly different than my original problem, it's still complaining.  The message in this case is "unit1_form1 is null or not an object".

---
Eric Schwarz
Thu, Sep 27 2012 3:54 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Eric,

<< All I did was create a new project, Add a line "Form1.Left := 100;" in
the OnCreate event.  Works ok in the OnShow event.  Verified it just now.
Although the test is slightly different than my original problem, it's still
complaining.  The message in this case is "unit1_form1 is null or not an
object". >>

The problem is the use of the 'Form1' variable.  Currently (I'm looking at
solutions for this), you have to use Self in the OnCreate for a form if you
want to get at the current form.  The Form1 variable isn't initialized yet
at the point that the OnCreate is called (form creation works a little bit
differently due to the way that JS works).

So, if you use this you'll be all set:

  Self.Left := 100;

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Image