Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing TFrame descendant's additional properties on the object inspector
    primarykey
    data
    text
    <p>Delphi object inspector doesn't show TFrame descendants's additional properties by design. People tend to suggest using a known trick which is commonly used for showing TForm descendant's properties on the Object inspector. The trick is: registering custom module for TForm descendants to Delphi IDE via design time package like:</p> <pre><code>RegisterCustomModule(TMyFrame, TCustomModule); </code></pre> <p>The object inspector can show additional properties of the TFrame Descendant's instance with this way but it loses its frame behaviours while it is embedded in a form. Not redesignable, not possible to implement events for its subcomponents and it accepts child controls (which it musn't). But it behaves normally in its own design area.</p> <p>Looks like, those behaviours provided by Delphi IDE specially just for TFrame. They problaly are not kind of generic facilities. </p> <p>Is there any other way to accomplish this without losing frame behaviours ?</p> <p>I'm using Delphi 2007</p> <hr> <p>@Tondrej,</p> <p>Read comments for the problem, thanks in advance.</p> <p>frameunit.dfm :</p> <pre><code>object MyFrame: TMyFrame Left = 0 Top = 0 Width = 303 Height = 172 TabOrder = 0 object Edit1: TEdit Left = 66 Top = 60 Width = 151 Height = 21 TabOrder = 0 Text = 'Edit1' end end </code></pre> <hr> <pre><code>unit frameunit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TBaseFrame = Class(TFrame) protected Fstr: string; procedure Setstr(const Value: string);virtual; published Property str:string read Fstr write Setstr; End; TMyFrame = class(TBaseFrame) Edit1: TEdit; private // This won't be called in designtime. But i need this to be called in designtime Procedure Setstr(const Value: string);override; end; implementation {$R *.dfm} { TBaseFrame } procedure TBaseFrame.Setstr(const Value: string); begin Fstr := Value; end; { TMyFrame } procedure TMyFrame.Setstr(const Value: string); begin inherited; Edit1.Text := Fstr; // Sadly this code won't work and Edit1 won't be updated in designtime. end; end. </code></pre> <hr> <pre><code>unit RegisterUnit; interface procedure Register; implementation uses Windows, DesignIntf, frameunit; procedure Register; var delphivclide: THandle; TFrameModule: TCustomModuleClass; begin delphivclide := GetModuleHandle('delphivclide100.bpl'); if delphivclide &lt;&gt; 0 then begin TFrameModule := GetProcAddress(delphivclide, '@Vclformcontainer@TFrameModule@'); if Assigned(TFrameModule) then begin RegisterCustomModule(frameunit.TBaseFrame, TFrameModule); // Just registering that won't cause Tmyframe to loose its frame behaviours // but additional properties won't work well. //RegisterCustomModule(frameunit.TMyFrame, TFrameModule); // That would cause Tmyframe to lose its frame behaviours // But additional properties would work well. end; end; end; end. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload