红鱼儿

访问FMX样式对象的事件处理程序

如何访问样式按钮的事件处理程序。例如,这有效:

ListBoxItem.StylesData['detail2.text'] := date;

但不是这样:

ListBoxItem.StylesData['downloadbutton.OnClick'] := LoadFileContent; //says not enough parameters. So when I put in 'LoadFileContent(nil) then I get an imcompatible types error message

这应该这样做:

uses
  //....
  System.Rtti;
  //....
  ListBoxItem.StylesData['downloadbutton.OnClick'] := TValue.From<TNotifyEvent>(LoadFileContent);

原文地址

https://www.thinbug.com/q/28440806

posted on 2021-07-24 13:39  红鱼儿  阅读(227)  评论(0编辑  收藏  举报