JDDEV Posted April 8, 2019 Share Posted April 8, 2019 Hi, I would like to create a new component with a inheritance from TuniForm class. On Delphi IDE the new component assistant interface doesn't permit to select TuniForm class ! Is it possible do to inheritance on this object class ? Thanks Link to comment Share on other sites More sharing options...
JDDEV Posted April 8, 2019 Author Share Posted April 8, 2019 Sorry....i've just fond the solution myself ! 1) I've created a new "application form" with the IDE 2) I've customized properties et functions of this form 3) I've used this new class for the inheritance of my main application form Link to comment Share on other sites More sharing options...
JDDEV Posted April 8, 2019 Author Share Posted April 8, 2019 that's not work anymore :( It was working the first time....but when i the project and then re-open it...there are warning dialogs and a message "Read error form UniMainForm". Link to comment Share on other sites More sharing options...
JDDEV Posted April 8, 2019 Author Share Posted April 8, 2019 That is the code of my First unit : unit UniMainForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIForm , uDefUser {a unit to manager user}; type TUniMainForm = class(TUniForm) procedure UniFormCreate(Sender: TObject); private { Private declarations } public { Public declarations } user:TUser; end; implementation {$R *.dfm} uses UniGUIVars, MainModule, uniGUIApplication; procedure TUniMainForm.UniFormCreate(Sender: TObject); begin initUser(user, True); end; initialization RegisterMainFormClass(TUniMainForm); end. That is the code of my 2d unit : unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, DateUtils , Vcl.Imaging.GIFImg, Vcl.Menus, Vcl.Imaging.jpeg, Vcl.Imaging.pngimage , Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons, Data.DB , uniGUITypes, uniGUIForm, UniListBox, UniMemo, UniLabel, UniPanel, UniPageControl, UniButton, UniSpeedButton, uniGUIRegClasses, uniguiclasses, uniMultiItem, UniBitBtn, uniGUIBaseClasses, uniSplitter, uniComboBox, uniScreenMask, uniHTMLMemo, uniBasicGrid, uniDBGrid, uniRadioGroup, uniGroupBox, uniSpinEdit, uniDateTimePicker, uniMainMenu, uniCheckBox, uniImage, uniRadioButton, uniScrollBox , uniMainForm ; type TMainForm = class(TUniMainForm) PanelUtilisateur: TUniPanel; BtnDeconnectUser: TUniSpeedButton; UniPanelTop: TUniPanel; UniLogoMini: TUniImage; UniLabelTitre: TUniLabel; UniPanelFond: TUniPanel; UniPanelActions: TUniPanel; LabelUtilisateur: TUniLabel; bkImage: TUniImage; UniScrollBox1: TUniScrollBox; BtnAction1: TUniBitBtn; BtnAction2: TUniBitBtn; BtnAction3: TUniBitBtn; BtnAction4: TUniBitBtn; procedure UniFormCreate(Sender: TObject); procedure UniFormShow(Sender: TObject); procedure BtnDeconnectUserClick(Sender: TObject); procedure UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); procedure BtnAction1Click(Sender: TObject); procedure BtnAction2Click(Sender: TObject); procedure BtnAction3Click(Sender: TObject); procedure BtnAction4Click(Sender: TObject); private { Private declarations } idFct:byte; bNeedConnexion:boolean; procedure GoAction(id:byte; bRefresh:boolean=False); public { Public declarations } function GetIdAction : byte; end; function MainForm: TMainForm; implementation {$R *.dfm} uses UniGUIVars, MainModule, UniGUIApplication, ServerModule; //------------------------------------------------------------------------------ function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; procedure TMainForm.UniFormCreate(Sender: TObject); begin ... end; procedure TMainForm.UniFormShow(Sender: TObject); begin ... end; procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin GoAction(idFct); end; procedure TMainForm.BtnDeconnectUserClick(Sender: TObject); begin close; end; procedure TMainForm.BtnAction1Click(Sender: TObject); begin GoAction(1); end; procedure TMainForm.BtnAction2Click(Sender: TObject); begin GoAction(2); end; procedure TMainForm.BtnAction3Click(Sender: TObject); begin GoAction(3); end; procedure TMainForm.BtnAction4Click(Sender: TObject); begin GoAction(4); end; //------------------------------------------------------------------------------ function TMainForm.GetIdAction : byte; begin result:=idFct; end; procedure TMainForm.GoAction(id:byte; bRefresh:boolean); var w,h:integer; titre:string; bOk:boolean; begin if (user.Login='')and(idFct>0) then exit; ... end; end. Link to comment Share on other sites More sharing options...
JDDEV Posted April 8, 2019 Author Share Posted April 8, 2019 The program work fine (compilation + runing), but i can't open the "Main.pas" unit on Delphi without error : "UniMainForm" not defined ? What is wrong in Delphi ??? Link to comment Share on other sites More sharing options...
JDDEV Posted April 10, 2019 Author Share Posted April 10, 2019 I find the problem ! A bad Copy/Paste of the class name in the .DFM file ! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now