FireMonkey - style

Programming/Delphi - FireMonkey 2013.11.16 22:00 Posted by 파란크리스마스

출처 : Firemonkey Styles - Felix John COLIBRI.
Working with Native and Custom FireMonkey Styles
Step 3 - Add Style-Resources as RCDATA (Delphi)
동영상 - FireMonkey - Style lookup& costom listbox item

style

  object TLayout
    StyleName = 'Layout1'
    DesignVisible = False
    Height = 32.000000000000000000
    Position.X = 499.000000000000000000
    Position.Y = 196.000000000000000000
    Width = 155.000000000000000000
    object TButton
      StyleName = 'Button1'
      Align = alRight
      Height = 32.000000000000000000
      Position.X = 75.000000000000000000
      TabOrder = 1
      Width = 80.000000000000000000
    end
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = alClient
      Color = claBlack
      Height = 17.000000000000000000
      HorzTextAlign = taLeading
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Width = 190.000000000000000000
      WordWrap = False
      Shadow.Color = claNull
      ShadowVisible = False
      ActiveTrigger = stSelected
      ActiveColor = claBlack
      ActiveShadow.Color = claNull
    end
  end

예제

procedure TForm1.FormCreate(Sender: TObject);
var
  _Item : TListBoxItem;
begin
  Self.OnGetMoveControl := GetMoveControl;

  _Item := TListBoxItem.Create(nil);
  _Item.Parent := ListBox1;
  _Item.StyleLookup := 'layout1';
  _Item.Text := 'a';
  (_Item.FindStyleResource('button1') as TButton).Text := 'test';
  (_Item.FindStyleResource('button1') as TButton).OnClick := ItemButtonClick;
end;

procedure TForm1.ItemButtonClick(Sender: TObject);
var
  VP: TPointF;
begin
  VP := (Sender as TButton).LocalToAbsolute((Sender as TButton).Position.Point);
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  {
  VP := (Sender as TButton).Position.Point;
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  }
  PopupMenu1.Popup(50, 50); // 모바일에서는 동작하지 않음

  ComboBox1.DropDown;
end;
신고


 

티스토리 툴바