Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-03

Visual form inheritance and importing Delphi forms ???

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bogusław Brandys

Hello,

How is VFI working in lazarus SVN ? Any documentation ?

I have a problem converting forms from delphi. A base form is:

type
   TInstantEditForm = class(TForm)
     SubjectExposer: TInstantExposer;
     SubjectSource: TDataSource;
     EditPanel: TPanel;
     BottomPanel: TPanel;
     ButtonPanel: TPanel;
     OkButton: TButton;
     CancelButton: TButton;
     procedure CancelButtonClick(Sender: TObject);
     procedure OkButtonClick(Sender: TObject);
     procedure FormCreate(Sender: TObject);
   private
     function GetSubject: TObject;
     procedure SetSubject(const Value: TObject);
   protected
     procedure LoadData; virtual;
     procedure SaveData; virtual;
     procedure SubjectChanged; virtual;
   public
     property Subject: TObject read GetSubject write SetSubject;
   end;

the inherited form just adds a lot of components to base form. Now when I try to import such Delphi forms both looks exactly the same as a base one in other words : all controls from inherited form is lost.

What can I do to fix it ?

Here is the inherited form declaration (quite big so I placed it at the end of this email) :

  TInstantAttributeEditorForm = class(TInstantEditForm)
     AccessSheet: TTabSheet;
     DefinitionSheet: TTabSheet;
     DisplayWidthEdit: TDBEdit;
     DisplayWidthLabel: TLabel;
     EditMaskEdit: TDBEdit;
     EdtMaskLabel: TLabel;
     MethodAddCheckBox: TCheckBox;
     MethodClearCheckBox: TCheckBox;
     MethodDeleteCheckBox: TCheckBox;
     MethodIndexOfCheckBox: TCheckBox;
     MethodInsertCheckBox: TCheckBox;
     MethodRemoveCheckBox: TCheckBox;
     MethodsGroupBox: TGroupBox;
     NameEdit: TDBEdit;
     NameLabel: TLabel;
     ObjectClassEdit: TDBComboBox;
     ObjectClassLabel: TLabel;
     OptionDefaultCheckBox: TCheckBox;
     OptionIndexedCheckBox: TCheckBox;
     OptionReadOnlyCheckBox: TCheckBox;
     OptionRequiredCheckBox: TCheckBox;
     OptionsGroupBox: TGroupBox;
     PageControl: TPageControl;
     PresentationSheet: TTabSheet;
     SingularNameEdit: TDBEdit;
     SingularNameLabel: TLabel;
     SizeEdit: TDBEdit;
     SizeLabel: TLabel;
     StorageNameEdit: TDBEdit;
     StorageNameLabel: TLabel;
     TypeEdit: TDBComboBox;
     TypeLabel: TLabel;
     ValidCharsEdit: TDBEdit;
     ValidCharsLabel: TLabel;
     VisibilityEdit: TDBComboBox;
     VisibilityLabel: TLabel;
     DefaultValueLabel: TLabel;
     DefaultValueEdit: TDBEdit;
     ExternalStorageNameEdit: TDBEdit;
     ExternalStorageNameLabel: TLabel;
     StorageKindEdit: TDBComboBox;
     StorageKindLabel: TLabel;
     AutoExternalStorageNameCheckBox: TCheckBox;
     procedure NameEditKeyPress(Sender: TObject; var Key: Char);
     procedure FormCreate(Sender: TObject);
     procedure NameEditChange(Sender: TObject);
     procedure NumericFieldGetText(Sender: TField; var Text: string;
       Display: Boolean);
     procedure ObjectClassEditChange(Sender: TObject);
     procedure ObjectClassEditEnter(Sender: TObject);
     procedure OkButtonClick(Sender: TObject);
     procedure SubjectExposerInitField(Sender: TObject; Field: TField);
     procedure SubjectExposerTranslate(Sender: TObject; Field: TField;
       var Value: Variant; Write: Boolean);
     procedure TypeEditClick(Sender: TObject);
     procedure StorageKindEditChange(Sender: TObject);
     procedure ExternalStorageNameEditChange(Sender: TObject);
     procedure AutoExternalStorageNameCheckBoxClick(Sender: TObject);
     procedure StorageNameEditChange(Sender: TObject);
   private
     FBaseClassStorageName: string;
     FLimited: Boolean;
     FMMUninitializedNewAttribute: Boolean;
     FModel: TInstantCodeModel;
     FOnIsClassPersistent: TInstantBooleanEvent;
     FOnLoadClasses: TInstantStringsEvent;
     FValidator: TInstantAttributeValidator;
     function GetSubject: TInstantCodeAttribute;
     procedure SetSubject(const Value: TInstantCodeAttribute);
     procedure SetLimited(Value: Boolean);
     procedure SetModel(const Value: TInstantCodeModel);
     procedure SetValidator(const Value: TInstantAttributeValidator);
   protected
     procedure LoadClasses;
     procedure LoadData; override;
     procedure LoadEnums(TypeInfo: PTypeInfo; Items: TStrings;
       Values: Pointer);
     procedure LoadTypes;
     procedure LoadVisibilities;
     procedure LoadStorageKind;
     procedure PopulateClasses;
     procedure SaveData; override;
     procedure SubjectChanged; override;
     procedure UpdateControls;
     procedure ComputeExternalStorageName;
     function IsClassPersistent(const AClassName: String): Boolean;
   public
     property BaseClassStorageName: string read FBaseClassStorageName write
       FBaseClassStorageName;
     property Limited: Boolean read FLimited write SetLimited;
     property Model: TInstantCodeModel read FModel write SetModel;
     property OnIsClassPersistent: TInstantBooleanEvent read
FOnIsClassPersistent
         write FOnIsClassPersistent;
     property OnLoadClasses: TInstantStringsEvent read FOnLoadClasses
       write FOnLoadClasses;
     property Subject: TInstantCodeAttribute read GetSubject write
SetSubject;
     property Validator: TInstantAttributeValidator read FValidator
write SetValidator;
   end;

Regards
Boguslaw

Reply by email

Mattias Gaertner
to Bogusław Brandys
Show quoted text 23 lines
Hello, How is VFI working in lazarus SVN ? Any documentation ? I have a problem converting forms from delphi. A base form is: type TInstantEditForm = class(TForm) [...] the inherited form just adds a lot of components to base form. Now when I try to import such Delphi forms both looks exactly the same as a base one in other words : all controls from inherited form is lost. What can I do to fix it ? Here is the inherited form declaration (quite big so I placed it at the end of this email) : TInstantAttributeEditorForm = class(TInstantEditForm) [...]

Maybe the inherited form was converted before the ancestor form. Then the IDE did not found an ancestor.lfm file.
Just close both designer forms and reopen them again.

Mattias

Reply by email

Graeme Geldenhuys
to Bogusław Brandys: How is VFI working in lazarus SVN ? Any documentation ? I have a problem converting forms…
Bogus?aw Brandys wrote 8 lines
What can I do to fix it ? Here is the inherited form declaration (quite big so I placed it at the end of this email) : TInstantAttributeEditorForm = class(TInstantEditForm)

VFI is not 100% in Lazarus as you have experienced... Edit the first line in the *.lfm file to say 'inherited'. Look at the Delphi *.dfm file for the correct format of that line. I think that should do the trick.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 15 lines
On 04/03/2008, Bogus?aw Brandys wrote: > > What can I do to fix it ? > > > Here is the inherited form declaration (quite big so I placed it > at the end of this email) : > > TInstantAttributeEditorForm = class(TInstantEditForm) VFI is not 100% in Lazarus as you have experienced... Edit the first line in the *.lfm file to say 'inherited'. Look at the Delphi *.dfm file for the correct format of that line. I think that should do the trick.

That's only

Reply by email

Bogusław Brandys
to Mattias Gaertner: On Tue, 04 Mar 2008 20:13:13 +0100 Maybe the inherited form was converted before the…
Mattias Gaertner wrote 34 lines
On Tue, 04 Mar 2008 20:13:13 +0100 Bogus?aw Brandys wrote: > Hello, > > How is VFI working in lazarus SVN ? Any documentation ? > > I have a problem converting forms from delphi. A base form is: > > type > TInstantEditForm = class(TForm) > [...] > the inherited form just adds a lot of components to base form. > Now when I try to import such Delphi forms both looks exactly the > same as a base one in other words : all controls from inherited form > is lost. > > > What can I do to fix it ? > > > Here is the inherited form declaration (quite big so I placed it at > the end of this email) : > > TInstantAttributeEditorForm = class(TInstantEditForm) > [...] Maybe the inherited form was converted before the ancestor form. Then the IDE did not found an ancestor.lfm file. Just close both designer forms and reopen them again. Mattias

There was because I used older Lazarus SVN version and VFI was not good enough.Now all is fine.Thank you.

Boguslaw

Reply by email