Search code examples
delphifiremonkeydelphi-xe8

Is it possible to have working OnClick event for TGlyph in FMX?


I just put an instance of TGlyph on a FMX Form and tested this code.

procedure TForm1.FormCreate(Sender: TObject);
begin
  Glyph1.OnClick:=myClick;  
end;

procedure TForm1.myClick(Sender: TObject);
begin
  ShowMessage('test');
end;

Nothing happening when I click the glyph. I know that there is no OnClick event for TGlyph in the Designer IDE. But this TGlyph has derived from TControl which has OnClick. I know that I can use TImage instead of TGlyph but I am just curiuse about that.


Solution

  • You have to set

    Glyph1.HitTest := true;
    

    to make it work.