Subject Re: [IBO] TIB_Grid.DefaultRowHeight
Author Frank Ingermann
Hi Lester,

lester@... wrote:
>
> > Any chance you are trying to set DefaultRowHeight to 24?
>
> That was the size I wanted - obviously RXGrid ends up with the same default.
> A lot of the forms are set up for a fixed number of lines, so I will just
> live with the manual approach for now.

As Geoff pointed out, all you really have to do is add the correct default
clause to the published declaration of TIB_Grid.

Open the IB_Grid.PBL and change line 19 from
property DefaultRowHeight;
to
property DefaultRowHeight default 17;

(Just tried it here and now 24 works ok.)

Btw. in my eyes this a real bug, because changing the default of a property in
the Create and *not* changing the property's default clause in the published
declaration always results in the *old* default value becoming practically
unuseable if set in the objinsp.

For those interested: ( non-IBO-related, just Delphi basics :)

What causes this is that Delphi only stores the values of properties in the
dfm that are *different* from the default, which is a very effective mechanism
to reduce the size of the dfm files.

The default is read from the last published declaration of the prop
up the inheritance chain that actually *has* a default clause. So you
set 24 in the objinsp, then save the form. Delphi finds that 24 *is* the
default (in TCustomGrid) and doesn't bother to stream it out (you can see
this when you open the dfm directly.)

When the form is loaded again, the grid is created before loading the
props. TCustomGrid.Create sets it to 24 (in the inherited create call in
TIB_Grid), and just after that TIB_Grid.Create sets it to 17 (inherited
DefaultRowHeight := 17) Since Delphi reads *no* prop value from the dfm
afterwards, the 17 persist, and 24 becomes unusable.

So a general hint for the component writers among you: if you change
any inherited settings in the Create of your comp, be sure to add a proper
default clause to your property declaration, otherwise you'll break Delphi's
default mechanism altogether!

(sorry for being so teacher-like, but i spent several hours on this
topic with my own components - and this error is *really* nasty for boolean
props ;-)

hth,
fingerman