【问题标题】:Custom component properties LiveBindings自定义组件属性 LiveBindings
【发布时间】:2016-06-12 23:12:54
【问题描述】:

我在将字符串属性绑定到 TLabel 时遇到问题。

TGotManager = class(TComponent)
..
..
published
  property HotQ1: String read FHotQ1 write SetHotQ1;
  property HotQ2: string read FHotQ2 write SetHotQ2;
..

我确实创建了一个组件,因为我不想使用 TPrototypeDatasource。

我的目标是通过设计器将这两个属性绑定到TLabel.text

我在这里的答案的帮助下做到了这一点:Delphi: Making a component visible to live binding

示例 1:

//with this only HotQ1 is bindable via the designer.
[ObservableMember('HotQ1')] 
TGotManager = class(TComponent)

示例 2:

//with this only HotQ2 is bindable via the designer.
[ObservableMember('HotQ1')] 
[ObservableMember('HotQ2')] 
TGotManager = class(TComponent)

问题是我只能通过设计器绑定一个属性。拖动该属性时,其他兼容的属性会亮起绿色。拖动第二个属性时,其他属性保持红色。

【问题讨论】:

  • “我只用一个属性成功了” 那么,你在其他属性上的失败是如何表现出来的呢?
  • @martynA 我会编辑问题并解释
  • @martynA 我希望它现在清楚

标签: delphi firemonkey livebindings


【解决方案1】:

我没有得到一个以上的属性来使用可视化实时绑定。我确实让它通过:

http://docwiki.embarcadero.com/RADStudio/Seattle/en/The_Entire_Project_and_Observing_the_Results

还可以参考和自动化澳大利亚用户组的此页面:http://www.adug.org.au/technical/vcl/using-livebindings-to-connect-the-ui-to-objects/

我不接受这个作为答案,因为这并没有解决问题。它提供了一种解决方法。

【讨论】:

    猜你喜欢
    • 2014-04-23
    • 2011-01-12
    • 1970-01-01
    • 2018-05-22
    • 1970-01-01
    • 1970-01-01
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多