unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects, FMX.ListBox, FMX.Layouts,
FMX.ScrollBox, FMX.Memo;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
ListBoxItem2: TListBoxItem;
Text1: TText;
Text2: TText;
Text3: TText;
Text4: TText;
Button1: TButton;
ListBoxItem1: TListBoxItem;
StyleBook1: TStyleBook;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
Function GetControlByStylename(aControl:TControl;aStylename:
String):TControl;
var i:integer;
fcontrol:tControl;
begin
fcontrol:=
nil;
Result :=
nil;
if aControl <>
nil then
begin
For i := 0
to aControl.Controlscount-1
do
Begin
if aControl.Controls[i].StyleName = aStylename
then
Begin
Result := aControl.Controls[i];
break;
End;
fcontrol := GetControlByStylename(aControl.Controls[i],aStylename);
if fcontrol <>
nil then
Begin
Result := fcontrol;
break;
End;
End;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var testv:Ttext;
aitem:TListboxItem;
i:Integer;
begin
{
Listboxitem2.StyleLookup := 'meinlistboxitemstyle';
Listboxitem2.StylesData['textro.Text'] := 'TEST';
testv := TText(Listboxitem2.FindStyleResource('meinlistboxitemstyle.textro'));
if Assigned(testv) then
testv.Text := 'BLA';
testv := TText(Listboxitem2.FindStyleResource('textro'));
if Assigned(testv) then
testv.Text := 'BLA2';
}
memo1.Lines.Clear;
aItem := TListboxItem(Listboxitem2.Controls[0]);
for i := 0
to aItem.ControlsCount-1
do
Begin
Memo1.Lines.Add(aItem.Controls[i].stylename+'
, '+aItem.Controls[i].classname );
End;
testv := TText(GetControlByStylename(Listboxitem2,'
textro'));
if assigned(testv)
then
testv.Text := '
HHHHHH';