Delphi 10.2 fmx Android

Delphi 10.2 fmx Android
This very simple program to display styles
give me fmx segmentation fault(11)
when used from PopupBox

private
{ Private declarations }
resname: string;
style: TFMXObject;


This is OK <<<<<<<<<<<<
procedure TForm1.Button2Click(Sender: TObject);
//var
//style: TFMXObject;
begin
style := FMX.Styles.TStyleManager.GetStyleResource('GoldenGraphite'); <<<< OK
if style <> nil then
TStyleManager.SetStyle(style);
end;

This is bad segmentation fault(11) <<<<<
procedure TForm1.PopupBox1Change(Sender: TObject);
//var
//resname: string;
//style: TFMXObject;
begin
resname := PopupBox1.Text;
style := FMX.Styles.TStyleManager.GetStyleResource(resname); <<< BAD
if style <> nil then
TStyleManager.SetStyle(style);
end;

Comments

  1. Can some one try this code since it is very simple
    and verify the problem.

    ReplyDelete
  2. H Visli Win32 is not the problem !!! Android is
    Delphi 10.2 fmx Android

    ReplyDelete
  3. Ok i am changing my question
    If i work with a button it is OK
    however triggering PopupBox WITHOUT USING IT
    give me fmx segmentation fault(11)

    procedure TForm1.PopupBox1Change(Sender: TObject); <begin
    //resname := PopupBox1.Text;
    resname := 'GoldenGraphite';
    style := FMX.Styles.TStyleManager.GetStyleResource(resname);
    if style <> nil then
    TStyleManager.SetStyle(style);
    end;

    ReplyDelete
  4. Well after trying to solve the problem i put a timer
    which fixed the problem for 2-3 iterations
    but it still ill behaved . So i droped the matter
    and i prefer for now to assess my use of fmx for Android
    against Android Studio.
    Thanks

    ReplyDelete
  5. Sorry, this does not compile on my dev machine. I have 10.2 update 1 and android set as the target. First error is TstyleManager is not the name of a unit.

    ReplyDelete
  6. steve hughes Add FMX.Styles to the uses.

    ReplyDelete
  7. This seem to work 3 Radiobuttons with no problems

    procedure TForm1.RadioButton1Click(Sender: TObject);
    begin
    with (Sender as TRadioButton) do
    begin

    resname := TRadioButton(Sender).Text;
    style := FMX.Styles.TStyleManager.GetStyleResource(resname);//'GoldenGraphite');
    if style <> nil then
    TStyleManager.SetStyle(style);

    end;

    ReplyDelete

Post a Comment