Board index » delphi » Inherited forms sized differently at run time than design time

Inherited forms sized differently at run time than design time

Hi,
  I'm making heavy use of visual form inheritance, and I've just encountered
a {*word*193} problem.

   I have a base dialog form with OK and Cancel buttons anchored to the
bottom.  At design time these are positioned correctly in this base form and
in all the inherited forms. However, when I compile and run, all forms have
acquired an extra inch or so of space at the bottom.
I can make the controls appear in the correct place on the forms by moving
them almost off the form, but this isn't a good solution.  Where is the
extra size of the form coming from?  What's going on?  Anyone hit anything
like this before?

--
Regards,

Matt Palmer
Author of mpDockManager
http://freespace.{*word*269}.net/matt.palmer/

 

Re:Inherited forms sized differently at run time than design time


I don't know why your forms are a different size than inherited. Perhaps you
changed their size at design time? If so, go into text view(alt+f12) of the
form, and delete the height and width entries.

When you place buttons on a form, you should always place them on a panel.
Align the panel to bottom of form, and then the buttons will always be in
the same relative position. Position constraints don't always give you the
desired behavior, so I would not use them.

Paul Gallagher

Quote
"Matt P" <matt.pal...@{*word*269}.net> wrote in message news:39c495f3_2@dnews...
> Hi,
>   I'm making heavy use of visual form inheritance, and I've just
encountered
> a {*word*193} problem.

>    I have a base dialog form with OK and Cancel buttons anchored to the
> bottom.  At design time these are positioned correctly in this base form
and
> in all the inherited forms. However, when I compile and run, all forms
have
> acquired an extra inch or so of space at the bottom.

> I can make the controls appear in the correct place on the forms by moving
> them almost off the form, but this isn't a good solution.  Where is the
> extra size of the form coming from?  What's going on?  Anyone hit anything
> like this before?

> --
> Regards,

> Matt Palmer
> Author of mpDockManager
> http://freespace.{*word*269}.net/matt.palmer/

Re:Inherited forms sized differently at run time than design time


Hmmm.  The problem isn't that the forms are a different size than inherited.
All the forms are sized individually.

The problem is that the part of the form which *is* inherited, ie, the
bottom bit with the OK and cancel buttons on it gets bigger - the form is
acquiring some extra space at the bottom.
The really strange thing is that the ancestor base form doesn't have this
space, and neither do the inherited forms.  But it's coming from
somewhere!...   Turning scaling *on* in the ancestor base form cures most of
the problems, but I don't want scaling on...

 The forms were originally designed with scaling on, and I later realised
that I didn't want the forms to scale, due to the well known problems this
introduces.  This must have something to do with it, interacting with
anchored controls, but whatever the cause, it can't be how Borland intended
it to work!

Here's how it looks:

Base form at design time:

+-----------------------------------------+
|                                                 |
|                                                 |
|                      OK   Cancel         |
+-----------------------------------------+

Inherited form at design time:

+-----------------------------------------+
|                                                 |
|                                                 |
|      Other Stuff                           |
|                                                 |
|                                                 |
|                      OK   Cancel         |
+-----------------------------------------+

Inherited form at runtime:

+-----------------------------------------+
|                                                 |
|                                                 |
|      Other Stuff                           |
|                                                 |
|                                                 |
|                      OK   Cancel         |
|                                                 | <---
|                                                 | <--- Extra form space
here.
+-----------------------------------------+

--
Regards,

Matt Palmer
Author of mpDockManager
http://freespace.{*word*269}.net/matt.palmer/

Quote
Paul Gallagher <p...@tansit.com> wrote in message

news:8q2jld$6rv3@bornews.borland.com...
Quote
> I don't know why your forms are a different size than inherited. Perhaps
you
> changed their size at design time? If so, go into text view(alt+f12) of
the
> form, and delete the height and width entries.

> When you place buttons on a form, you should always place them on a panel.
> Align the panel to bottom of form, and then the buttons will always be in
> the same relative position. Position constraints don't always give you the
> desired behavior, so I would not use them.

> Paul Gallagher

> "Matt P" <matt.pal...@{*word*269}.net> wrote in message

news:39c495f3_2@dnews...
Quote
> > Hi,
> >   I'm making heavy use of visual form inheritance, and I've just
> encountered
> > a {*word*193} problem.

> >    I have a base dialog form with OK and Cancel buttons anchored to the
> > bottom.  At design time these are positioned correctly in this base form
> and
> > in all the inherited forms. However, when I compile and run, all forms
> have
> > acquired an extra inch or so of space at the bottom.

> > I can make the controls appear in the correct place on the forms by
moving
> > them almost off the form, but this isn't a good solution.  Where is the
> > extra size of the form coming from?  What's going on?  Anyone hit
anything
> > like this before?

> > --
> > Regards,

> > Matt Palmer
> > Author of mpDockManager
> > http://freespace.{*word*269}.net/matt.palmer/

Re:Inherited forms sized differently at run time than design time


Sorry, no solution, but I have had the same problem with my MDI application,
while my SDI application was OK.
(I've been testing both MDI and SDI for the same application, just to see which
one would be preferable).

Maybe some resizing is done of the childs in an MDI application ?

Michael

Quote
Matt P wrote:
> Hmmm.  The problem isn't that the forms are a different size than inherited.
> All the forms are sized individually.

> The problem is that the part of the form which *is* inherited, ie, the
> bottom bit with the OK and cancel buttons on it gets bigger - the form is
> acquiring some extra space at the bottom.

Re:Inherited forms sized differently at run time than design time


If your forms have BorderStyle: bsToolWindow or bsSizeableToolWindow,
then the size of form differs at runtime and designtime, because the size of
forms' caption is different. Form sets its Height to the Height specified at
designtime, but it doesn't pay attention to the changing of caption size.
I think it is a bug of Delphi or Windows,
Anyway the solution may be to make your form's height less at design time...
If you are using different BorderStyle, I can't really imagine what the problem
could be...
CU
Quote
Matt P wrote:
> Hmmm.  The problem isn't that the forms are a different size than inherited.
> All the forms are sized individually.

> The problem is that the part of the form which *is* inherited, ie, the
> bottom bit with the OK and cancel buttons on it gets bigger - the form is
> acquiring some extra space at the bottom.

> The really strange thing is that the ancestor base form doesn't have this
> space, and neither do the inherited forms.  But it's coming from
> somewhere!...   Turning scaling *on* in the ancestor base form cures most of
> the problems, but I don't want scaling on...

>  The forms were originally designed with scaling on, and I later realised
> that I didn't want the forms to scale, due to the well known problems this
> introduces.  This must have something to do with it, interacting with
> anchored controls, but whatever the cause, it can't be how Borland intended
> it to work!

> Here's how it looks:

> Base form at design time:

> +-----------------------------------------+
> |                                                 |
> |                                                 |
> |                      OK   Cancel         |
> +-----------------------------------------+

> Inherited form at design time:

> +-----------------------------------------+
> |                                                 |
> |                                                 |
> |      Other Stuff                           |
> |                                                 |
> |                                                 |
> |                      OK   Cancel         |
> +-----------------------------------------+

> Inherited form at runtime:

> +-----------------------------------------+
> |                                                 |
> |                                                 |
> |      Other Stuff                           |
> |                                                 |
> |                                                 |
> |                      OK   Cancel         |
> |                                                 | <---
> |                                                 | <--- Extra form space
> here.
> +-----------------------------------------+

> --
> Regards,

> Matt Palmer
> Author of mpDockManager
> http://freespace.{*word*269}.net/matt.palmer/
> Paul Gallagher <p...@tansit.com> wrote in message
> news:8q2jld$6rv3@bornews.borland.com...
> > I don't know why your forms are a different size than inherited. Perhaps
> you
> > changed their size at design time? If so, go into text view(alt+f12) of
> the
> > form, and delete the height and width entries.

> > When you place buttons on a form, you should always place them on a panel.
> > Align the panel to bottom of form, and then the buttons will always be in
> > the same relative position. Position constraints don't always give you the
> > desired behavior, so I would not use them.

> > Paul Gallagher

> > "Matt P" <matt.pal...@{*word*269}.net> wrote in message
> news:39c495f3_2@dnews...
> > > Hi,
> > >   I'm making heavy use of visual form inheritance, and I've just
> > encountered
> > > a {*word*193} problem.

> > >    I have a base dialog form with OK and Cancel buttons anchored to the
> > > bottom.  At design time these are positioned correctly in this base form
> > and
> > > in all the inherited forms. However, when I compile and run, all forms
> > have
> > > acquired an extra inch or so of space at the bottom.

> > > I can make the controls appear in the correct place on the forms by
> moving
> > > them almost off the form, but this isn't a good solution.  Where is the
> > > extra size of the form coming from?  What's going on?  Anyone hit
> anything
> > > like this before?

> > > --
> > > Regards,

> > > Matt Palmer
> > > Author of mpDockManager
> > > http://freespace.{*word*269}.net/matt.palmer/

Re:Inherited forms sized differently at run time than design time


Nope.  Borderstyle is a normal default borderstyle on all forms.   Changing
the form size at design time of either the base form or the inherited forms
makes *absolutely no difference* to the extra space which appears at the
bottom of the form at runtime.
  This is the problem - the form is acquiring space which just doesn't
appear at design time, no matter what I do.  I can cure the problem by
moving the OK and Cancel buttons almost off the edge of the form at design
time.  They then appear in roughly the correct position at runtime.  So the
controls anchor to the form as if they are{*word*154} off the form, but then
the form acquires some extra height, so all is well... very strange.

  But this isn't a solution; it's a kludge to get around a bug in the way
Delphi is handling VFI, anchoring and form scaling.

Matt

Quote
"Andrey Adamovich" <adamov...@solcraft.lv> wrote in message

news:39C5D990.1900E65A@solcraft.lv...
Quote
> If your forms have BorderStyle: bsToolWindow or bsSizeableToolWindow,
> then the size of form differs at runtime and designtime, because the size
of
> forms' caption is different. Form sets its Height to the Height specified
at
> designtime, but it doesn't pay attention to the changing of caption size.
> I think it is a bug of Delphi or Windows,
> Anyway the solution may be to make your form's height less at design
time...
> If you are using different BorderStyle, I can't really imagine what the
problem
> could be...
> CU

> Matt P wrote:

> > Hmmm.  The problem isn't that the forms are a different size than
inherited.
> > All the forms are sized individually.

> > The problem is that the part of the form which *is* inherited, ie, the
> > bottom bit with the OK and cancel buttons on it gets bigger - the form
is
> > acquiring some extra space at the bottom.

> > The really strange thing is that the ancestor base form doesn't have
this
> > space, and neither do the inherited forms.  But it's coming from
> > somewhere!...   Turning scaling *on* in the ancestor base form cures
most of
> > the problems, but I don't want scaling on...

> >  The forms were originally designed with scaling on, and I later
realised
> > that I didn't want the forms to scale, due to the well known problems
this
> > introduces.  This must have something to do with it, interacting with
> > anchored controls, but whatever the cause, it can't be how Borland
intended
> > it to work!

> > Here's how it looks:

> > Base form at design time:

> > +-----------------------------------------+
> > |                                                 |
> > |                                                 |
> > |                      OK   Cancel         |
> > +-----------------------------------------+

> > Inherited form at design time:

> > +-----------------------------------------+
> > |                                                 |
> > |                                                 |
> > |      Other Stuff                           |
> > |                                                 |
> > |                                                 |
> > |                      OK   Cancel         |
> > +-----------------------------------------+

> > Inherited form at runtime:

> > +-----------------------------------------+
> > |                                                 |
> > |                                                 |
> > |      Other Stuff                           |
> > |                                                 |
> > |                                                 |
> > |                      OK   Cancel         |
> > |                                                 | <---
> > |                                                 | <--- Extra form
space
> > here.
> > +-----------------------------------------+

> > --
> > Regards,

> > Matt Palmer
> > Author of mpDockManager
> > http://freespace.{*word*269}.net/matt.palmer/
> > Paul Gallagher <p...@tansit.com> wrote in message
> > news:8q2jld$6rv3@bornews.borland.com...
> > > I don't know why your forms are a different size than inherited.
Perhaps
> > you
> > > changed their size at design time? If so, go into text view(alt+f12)
of
> > the
> > > form, and delete the height and width entries.

> > > When you place buttons on a form, you should always place them on a
panel.
> > > Align the panel to bottom of form, and then the buttons will always be
in
> > > the same relative position. Position constraints don't always give you
the
> > > desired behavior, so I would not use them.

> > > Paul Gallagher

> > > "Matt P" <matt.pal...@{*word*269}.net> wrote in message
> > news:39c495f3_2@dnews...
> > > > Hi,
> > > >   I'm making heavy use of visual form inheritance, and I've just
> > > encountered
> > > > a {*word*193} problem.

> > > >    I have a base dialog form with OK and Cancel buttons anchored to
the
> > > > bottom.  At design time these are positioned correctly in this base
form
> > > and
> > > > in all the inherited forms. However, when I compile and run, all
forms
> > > have
> > > > acquired an extra inch or so of space at the bottom.

> > > > I can make the controls appear in the correct place on the forms by
> > moving
> > > > them almost off the form, but this isn't a good solution.  Where is
the
> > > > extra size of the form coming from?  What's going on?  Anyone hit
> > anything
> > > > like this before?

> > > > --
> > > > Regards,

> > > > Matt Palmer
> > > > Author of mpDockManager
> > > > http://freespace.{*word*269}.net/matt.palmer/

Re:Inherited forms sized differently at run time than design time


I've had a number of problems with MDI children not being created at
designed size. For me the most stable Position choice was
"poDefaultPosOnly". "poDesigned" was not at all what I expected.
Of course, as pretty much everyone around here tells me there are quite
a few flaws in MDI - both from MicroSoft and in the VCL.

Other Threads