Fabrizio
Fabrizio

Reputation: 8043

Does the order of properties in DFM file matter?

Could a not-standard order of the properties cause any problem?

For example, the IDE stores a TButton component in the DFM file as follows:

  object Button1: TButton
    Left = 288
    Top = 160
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end

If I manually change the order of the properties, could this cause any problem?

  object Button1: TButton     
    OnClick = Button1Click
    Left = 288
    Top = 160
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
  end

Upvotes: 2

Views: 340

Answers (3)

MartynA
MartynA

Reputation: 30725

It makes no difference afaik.

The TReader class is responsible for handling the reading of component properties from the DFM stream. This operates by creating a "fix-up list" of property values read from the stream, which is used, after the entire component has been read in, to set the component's properties. See the Streaming chapter in Delphi Component Design by Danny Thorpe (ISBN 0-201-46136-6) for much fuller details any why it was designed the way it is.

I see Uwe Raabe has added an answer, and he's usually right ime.

Upvotes: 0

Uwe Raabe
Uwe Raabe

Reputation: 47758

There seem to be cases where the order actually matters!

For examples see the comments in the published section of TStandardColorMap, TActionManager, TActionClientItem, TTabControl, TTreeView, TMonthCalendar, TDateTimePicker and TComboBoxEx (to just name a few from Vcl), where the order of published properties is relevant.

As the order of properties in the DFM determines the order the published properties are set, any other order may affect the values of the properties after reading a component from the DFM.

The fix-up mechanism mentioned by MartynA in another answer is not used for these sort of properties.

Upvotes: 6

SilverWarior
SilverWarior

Reputation: 8376

As far as I know order of properties in DFM file doesn't matter.

Upvotes: -1

Related Questions