tags:

views:

81

answers:

1

Especially to populate the "inheritable items" and "forms creation" dialogs

I am asking because since a few days, I cannot create inheritable items anymore as there is a space (or a tab?) appended to each form name so I end up with an error message when inheriting like 'basewindow 2 is not a valid identifier' (notice the space between basewindow and 2)

This is very blocking for me as all the forms in the project are inherited from a common ancestor ...

Note: on the newly created froms, there are no space and they work fine. It is a plan d2010 setup, no extra IDE tools or utilities loaded; Note 2: this relates to one project only

Any idea ?

thanks in advance Didier

+6  A: 

I have done some investigation into this in relation to the question: http://stackoverflow.com/questions/3733216/register-custom-form-so-i-can-inherit-from-it-from-multiple-projects-without-cop. Although it isn't in my answer there, I have since concluded that the IDE will only let you inherit from items explicitely added to the project.

I would therefore say that it picks up those inheritable items from the dpr file. A line like

  UnitOKFrame in 'UnitOKFrame.pas' {OKFrame: TFrame},

would add an OKFrame to the inheritable items list.

So my "guess" is that somehow you have gotten extra spaces between the name of your forms/frames and the colon that separates it from its type. Something like:

  UnitOKFrame in 'UnitOKFrame.pas' {OKFrame : TFrame},

If that is indeed the case, I would file a QC report with Embarcadero. They could bother to make the parsing of the dpr a bit more robust and friendly to us poor programmers :-)...


As Uwe mentioned in the comments, forms are included without a type identifier:

  UnitLogonForm in 'UnitLogonForm.pas' {LogonForm},

in this case you might have extra spaces between the curly braces surrounding the actual name:

  UnitLogonForm in 'UnitLogonForm.pas' {LogonForm },
Marjan Venema
In case of a form the colon and classname is omitted.
Uwe Raabe
@Uwe: thanks hadn't noticed that. Will amend my answer to include it.
Marjan Venema
IIRC using the builtin code formatter on a *.dpr breaks the pas-dfm correlation by inserting extra spaces.
Ulrich Gerhardt
+1, for most practical purposes this is (unfortunately) where the IDE gets it's list from. Theoretically you can also write an Expert to add new items to the "New" gallery".
Cosmin Prund
Marjan, you are absolutely spot on; and I know how I did that: I reformated (ctrl+D) by accident instead of saving (CTRL+S) the dpr!!! After that I had several misbehavior : could not inherit windows, when opening the project the mainform would not open, sometimes forms would not be found in the project etc ... I'll file a QC
Didiergm