Forum > General

class derived from TForm not in object inspector

(1/2) > >>

watte:
hello!

Sorry my english is not good, but I hope you can understand me...  ;D

I programmed a new Form (TMySpecialForm) derived form TForm with additional published properties. But the object inspector will not show this.
It seems, that the ide (on loading the unit) allways creates TForm?.

what could be wrong?  :'(

Marc:
The IDE only can do RTTI on components installed into the IDE. IT needs the compiled form RTTI info to show the propereties.

watte:
RTTI?! - What can I do? My form is in a package. Is there a special way to register my form?



I did Register a new FileDescriptor with RegisterProjectFileDescriptor. Than I got a new Option in the menu "New...". When I klick this new Form, I got a new unit with my TMySpecialForm and the objectinspector show my additional properties too.  8) work fine!

But after saving and load the project, lazarus tell me property "X" do not exist... and so on. And the object inspector shows just the TForm-properties :(

So I had debug the lazarus-project on loading my project. -> The IDE do seeing that my Form is a TMySpecialForm

--- Quote ---   ( JITForms ) -> ( function TJITComponentList.DoCreateJITComponent )
Instance:=TComponent(FCurReadClass.NewInstance);

--- End quote ---

...but creates always a TForm


--- Quote ---   ( JITForms ) -> ( function TJITComponentList.DoCreateJITComponent )
Instance.Create(nil);

--- End quote ---
-> jump to "TForm.Create(..."

is it a bug? or have I to register something more?

Marc:

--- Quote from: watte on August 05, 2010, 07:41:00 am ---RTTI?! - What can I do? My form is in a package. Is there a special way to register my form?

--- End quote ---

that wasn't clear from your first post. Indeed, the IDE should now know your form.


--- Quote ---I did Register a new FileDescriptor with RegisterProjectFileDescriptor. Than I got a new Option in the menu "New...". When I klick this new Form, I got a new unit with my TMySpecialForm and the objectinspector show my additional properties too.  8) work fine!

--- End quote ---

Thats good.


--- Quote ---But after saving and load the project, lazarus tell me property "X" do not exist... and so on. And the object inspector shows just the TForm-properties :(

So I had debug the lazarus-project on loading my project. -> The IDE do seeing that my Form is a TMySpecialForm

--- Quote ---   ( JITForms ) -> ( function TJITComponentList.DoCreateJITComponent )
Instance:=TComponent(FCurReadClass.NewInstance);

--- End quote ---

--- End quote ---

What is FCurReadClass.NewInstance calling ? And what is Instance ?


--- Quote ---...but creates always a TForm


--- Quote ---   ( JITForms ) -> ( function TJITComponentList.DoCreateJITComponent )
Instance.Create(nil);

--- End quote ---
-> jump to "TForm.Create(..."

--- End quote ---

Do you have a virtual overridden TMySpecialForm.Create() ? If not then TForm.Create is called.

watte:
Thanks for your answer!


--- Quote ---What is FCurReadClass.NewInstance calling ? And what is Instance ?
--- End quote ---

( lazarus/designer/jitforms.pp )

FCurReadClass is a class of TMySpecialForm1 (the name of the class in my project. unit1 -> TMySpecialForm1 = class(TMySpecialForm)... )
FCurReadClass.NewInstance jump to class function TLCLComponent.NewInstance: TObject;
Instance is a TComponent


--- Quote ---Do you have a virtual overridden TMySpecialForm.Create() ? If not then TForm.Create is called.
--- End quote ---
Yes I have a overridden Create in my class, but the IDE jumps just to TForm.Create


--- Quote ---..Indeed, the IDE should now know your form.
--- End quote ---
In my package, all components are registert by RegisterComponent. But not my forms (because it is no component). Maybe that is the reason...
I don't know how to register a form. Is there a special function?





Navigation

[0] Message Index

[#] Next page

Go to full version