Delphi XE8 FMX: Visibility of Actions on a button from another form

  

I have the following problem with firemonkey and Delphi XE8:

I have 2 forms. The main form (form1) is build on start and the second form (form2) is build on demand.
form1 has two buttons. btn1 creates form2 and btn2 is then linked to an action on form2.
form2 now has btn1 to change the visibility of the action. The action is not visible at start. (all works fine if the action is visible at the beginning)

Changing the visibility of the action won’t make the btn2 visible on form1. But if you click where the btn2 is, it reacts. So it seems to be that btn2 is just not properly updated. I tried a lot to but am now all out of ideas. (It runs as expected with XE8 VCL and it worked with fmx under XE7)

Any input is highly appreciated.

Source:

Unit1:

unit Unit1;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, unit2,
FMX.Controls.Presentation, FMX.StdCtrls;

type
TForm1 = class(TForm)
btn1: TButton;
btn2: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
FFrm2: TForm2;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.btn1Click(Sender: TObject);
begin
FFrm2 := TForm2.Create(nil);
btn2.Action := FFrm2.actBeep;
FFrm2.Show;
end;

end.

Unit2:

unit Unit2;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Actions,
FMX.ActnList, FMX.Controls.Presentation, FMX.StdCtrls;

type
TForm2 = class(TForm)
actlst1: TActionList;
actBeep: TAction;
btn1: TButton;
btn2: TButton;
procedure actBeepExecute(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.fmx}

procedure TForm2.actBeepExecute(Sender: TObject);
begin
Beep;
end;

procedure TForm2.btn1Click(Sender: TObject);
begin
actBeep.Visible := not(actBeep.Visible);
end;

end.

Comments are closed.