Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


How to avoid saving a property to dfm file?

How to avoid saving a property to dfm file?

How to avoid saving a property to dfm file?

Hi there,

I've built a grid control inherited from TStringGrid for which I do not want to save a specific property (since it is always determined at run-time). The property in question is RowHeights (array property inherited from TCustomGrid).

Even if I redeclared the property within my control as


property RowHeights stored False; 

In the dfm, values still stored as


object cgrCalc: TMyGrid
  RowHeights = (

After modification done at design-time in some forms implementing the control (via a frame), there's a run-time error raised saying there's an Invalid Property Value and prevents from opening the form. After editing and deleting the RowHeights property right in the dfm, the next exe compilation is ok. But I would like to avoid editing the dfm to delete RowHeights after any minor changes in the code.

The migration from D2010 -> DXE7 is harder than what I thought at first place... :-/

RE: How to avoid saving a property to dfm file?

With about anything, including Delphi, I've always taken any auto-generated files to be uneditable, unless I can copy it out (and I have to sometimes for type libraries as they get translated improperly a lot of times). When I want certain properties assured in my Delphi projects, I specifically set them in the Create event for the form the control is on and forget the property sheets. Of course, if that's an issue, you can always dynamically create and place the control onto the form.

As for the question of the properties, when you inherit from another control, you're pretty much stuck with what you get from the other control. The only other thing you may try different is to register your control into the IDE (i.e. so you can click it in the IDE menu and put it onto your form), as you have to do that before the IDE itself knows what to do about the control. Since your control descends from a parent control that will be registered within the IDE, it probably is taking on the behaviors the IDE knows about from that control.

Not sure that'll help out, but hope it does.

RE: How to avoid saving a property to dfm file?

Thanks for reply,

I know, an autogenerated file must be handle with care :-/ In fact, I've never had to play directly in the dfm (I swear!), it's the reason behind this post: I don't want to do it on a regular basis. The problem is there only since migration of our projects from D2010 to XE7. The worst point is that compilation always succeeded while run-time error Invalid Property Value is raised before displaying the form.

I read that properties are written to the dfm only when default values are changed... but this is not my case. Anyway, I will continue to search for a solution and I will post results here.

Thanks again for your time,


RE: How to avoid saving a property to dfm file?

OK finally I get rid of the problem...

The run-time error Invalid Property Value is no more raised after I edited the form's dfm AND all frames dfm taking place in the form. The task consists of deleting all occurences of DefaultRowHeight, RowCount and RowHeights. In some frame's dfm, I saw RowCount=6 while RowHeights stops at 5...???... I think this was causing the error since I can now make minor changes to the form and all is ok on run-time.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close