Sign in Join

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

Mailing lists / lazarus / 2021-06

Registering a TFrame to component palette

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Juha Manninen

Regarding issue : https://bugs.freepascal.org/view.php?id=28450

The parameter passed to function RegisterComponents() is TComponentClass which means "class of TComponent". It is only type information and does not carry information about sub-components.
Could somebody please explain how it works in Delphi. Does this really work :

  RegisterComponents('Sample', [TMyFrame]);

I added a comment to the report but it is old and the reporter may not read it.
Maybe there should be a new function RegisterFrame() or similar?

Regards
Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210612/000ba77a/attachment.html>

Reply by email

Sven Barth
to Juha Manninen
Juha Manninen wrote 9 lines
Regarding issue : https://bugs.freepascal.org/view.php?id=28450 <https://bugs.freepascal.org/view.php?id=28450> The parameter passed to function RegisterComponents() is TComponentClass which means "class of TComponent". It is only type information and does not carry information about sub-components. Could somebody please explain how it works in Delphi. Does this really work :   RegisterComponents('Sample', [TMyFrame]);

Yes, it does work this way. I don't know what you mean with "information about sub-components". The VMT vFieldTable entry contains all published fields of the class and thus all the sub controls that are visible through the RTTI and thus for the designer. If the IDE does not use that yet, then it definitly should.

I added a comment to the report but it is old and the reporter may not read it. Maybe there should be a new function RegisterFrame() or similar?

There is no need to add anything, because the necessary information is already there. It's just that the IDE doesn't use it yet.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210613/f4966aa3/attachment.html>

Reply by email

Michael Van Canneyt
to Sven Barth
Sven Barth wrote 23 lines
Am 11.06.2021 um 23:48 schrieb Juha Manninen via lazarus: > Regarding issue : https://bugs.freepascal.org/view.php?id=28450 > <https://bugs.freepascal.org/view.php?id=28450> > > The parameter passed to function RegisterComponents() is TComponentClass > which means "class of TComponent". It is only type information and does not > carry information about sub-components. > Could somebody please explain how it works in Delphi. Does this really work > : >   RegisterComponents('Sample', [TMyFrame]); Yes, it does work this way. I don't know what you mean with "information about sub-components". The VMT vFieldTable entry contains all published fields of the class and thus all the sub controls that are visible through the RTTI and thus for the designer. If the IDE does not use that yet, then it definitly should. > I added a comment to the report but it is old and the reporter may not read > it. > Maybe there should be a new function RegisterFrame() or similar? There is no need to add anything, because the necessary information is already there. It's just that the IDE doesn't use it yet.

In Delphi, the above also does not work, you need special handling for frames, just as for forms.

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt

Michael Van Canneyt schrieb am So., 13. Juni 2021, 13:53:

Show quoted text 37 lines
On Sun, 13 Jun 2021, Sven Barth via lazarus wrote: > Am 11.06.2021 um 23:48 schrieb Juha Manninen via lazarus: >> Regarding issue : https://bugs.freepascal.org/view.php?id=28450 >> <https://bugs.freepascal.org/view.php?id=28450> >> >> The parameter passed to function RegisterComponents() is TComponentClass >> which means "class of TComponent". It is only type information and does not >> carry information about sub-components. >> Could somebody please explain how it works in Delphi. Does this really work >> : >> RegisterComponents('Sample', [TMyFrame]); > > Yes, it does work this way. I don't know what you mean with "information > about sub-components". The VMT vFieldTable entry contains all published > fields of the class and thus all the sub controls that are visible through > the RTTI and thus for the designer. If the IDE does not use that yet, then it > definitly should. > >> I added a comment to the report but it is old and the reporter may not read >> it. >> Maybe there should be a new function RegisterFrame() or similar? > > There is no need to add anything, because the necessary information is > already there. It's just that the IDE doesn't use it yet. In Delphi, the above also does not work, you need special handling for frames, just as for forms.

You think I didn't test it before writing? I created a frame, added it to a package, added a Register procedure, installed the package, started a new VCL application and added that frame to the form from the component palette. I had added a button and a combo box and both were visible in the designer.

Or did I miss something here?

Regards,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210613/ed7811e8/attachment.html>

Reply by email

Juha Manninen

It went to Sven Barth only, forwarding here.
I clicked the reply button as always. I don't know what happened.

---------- Forwarded message ---------

Earlier message 22 lines
From: Juha Manninen Date: Sun, Jun 13, 2021 at 6:41 PM Subject: Re: [Lazarus] Registering a TFrame to component palette To: Sven Barth On Sun, Jun 13, 2021 at 2:50 PM Sven Barth wrote: > Yes, it does work this way. I don't know what you mean with "information > about sub-components". The VMT vFieldTable entry contains all published > fields of the class and thus all the sub controls that are visible through > the RTTI and thus for the designer. If the IDE does not use that yet, then > it definitly should. > Ok, through RTTI, yes. Juha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210613/d764f221/attachment.html>

Reply by email

Sven Barth
to Juha Manninen

Juha Manninen via lazarus schrieb am So.,
13. Juni 2021, 18:45:

It went to Sven Barth only, forwarding here. I clicked the reply button as always. I don't know what happened.

Probably because I used "Reply to all" and your e-mail client then picked up my address instead of the list's.

Regards,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210613/d6c175e4/attachment-0001.html>

Reply by email

Michael Van Canneyt
to Sven Barth: Michael Van Canneyt schrieb am So., 13. Juni 2021, 13:53: You think I didn't test it…
Sven Barth wrote 46 lines
Michael Van Canneyt schrieb am So., 13. Juni 2021, 13:53: > > > On Sun, 13 Jun 2021, Sven Barth via lazarus wrote: > >> Am 11.06.2021 um 23:48 schrieb Juha Manninen via lazarus: >>> Regarding issue : https://bugs.freepascal.org/view.php?id=28450 >>> <https://bugs.freepascal.org/view.php?id=28450> >>> >>> The parameter passed to function RegisterComponents() is > TComponentClass >>> which means "class of TComponent". It is only type information and does > not >>> carry information about sub-components. >>> Could somebody please explain how it works in Delphi. Does this really > work >>> : >>> RegisterComponents('Sample', [TMyFrame]); >> >> Yes, it does work this way. I don't know what you mean with "information >> about sub-components". The VMT vFieldTable entry contains all published >> fields of the class and thus all the sub controls that are visible > through >> the RTTI and thus for the designer. If the IDE does not use that yet, > then it >> definitly should. >> >>> I added a comment to the report but it is old and the reporter may not > read >>> it. >>> Maybe there should be a new function RegisterFrame() or similar? >> >> There is no need to add anything, because the necessary information is >> already there. It's just that the IDE doesn't use it yet. > > In Delphi, the above also does not work, you need special handling for > frames, just as for forms. > You think I didn't test it before writing? I created a frame, added it to a package, added a Register procedure, installed the package, started a new VCL application and added that frame to the form from the component palette. I had added a button and a combo box and both were visible in the designer.

I think there was a misunderstanding. You want to place a frame on a form, just like a component.

I confused this with actually creating custom forms.

I have always used (since D7) a special designer call for this.

With (BorlandIDEServices As IOTAModuleServices) Do
   CreateModule(TMKFormWizardModuleCreator.Create(FBaseClass, FClause,FUseInherited) As IOTACreator);

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 6 lines
[...] I have always used (since D7) a special designer call for this. With (BorlandIDEServices As IOTAModuleServices) Do CreateModule(TMKFormWizardModuleCreator.Create(FBaseClass, FClause,FUseInherited) As IOTACreator);

Lazarus:
FormEditingHook.RegisterDesignerBaseClass

Mattias

Reply by email