2016-03-29 5 views
3

デルファイXE-6私はグループボックスにTGridPanelLayoutコントロールを作成TGroupBoxの由来独自のカスタムFireMonkeyのコントロールを作成しようとしていますFireMonkeyの

で複合コントロールを作成します。

constructor TMyRadioGroup.Create(AOwner: TComponent); 
begin 
    inherited Create(AOwner); 
    FLayout:= TGridPanelLayout.Create(self); 
    FLayout.Parent:= self; 
end; 

TGridPanelLayoutコントロールをユーザーが選択または削除できないようにするにはどうすればよいですか?設計時には、親コントロール(TGroupboxから派生)をフォームから選択可能かつ削除可能にしたいだけです。

答えて

4

Storedプロパティをデザイン時に選択したくない子コントロールごとにfalseに設定する必要があります。たとえば、次のコードでは、2つの子コントロール、TEditおよびTButtonを持つパネルを作成します。

unit PanelCombo; 

interface 

uses 
    System.SysUtils, System.Classes, FMX.Types, FMX.Controls, 
    FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit; 

type 
    TPanelCombo = class(TPanel) 
    private 
    { Private declarations } 
    edit1: TEdit; 
    button1: TButton; 
    protected 
    { Protected declarations } 
    public 
    { Public declarations } 
    constructor Create(AOwner: TComponent); override; 
    destructor Destroy; override; 
    published 
    { Published declarations } 
    end; 

procedure Register; 

implementation 

procedure Register; 
begin 
    RegisterComponents('Samples', [TPanelCombo]); 
end; 

constructor TPanelCombo.Create(AOwner: TComponent); 
begin 
    inherited; 
    edit1:= TEdit.create(self); 
    edit1.parent:= self; 
    edit1.align:= TAlignLayout.Top; 
    edit1.stored:= false; 

    button1:= TButton.create(self); 
    button1.parent:= self; 
    button1.align:= TAlignLayout.bottom; 
    button1.stored:= false; 
end; 

destructor TPanelCombo.Destroy; 
begin 
    inherited; 
    edit1.Free; 
    button1.Free; 
end; 

end. 
+0

Ahhhhhhh - ありがとうございました! – JakeSays