2016-06-12 53 views
1

我有绑定字符串属性到TLabel的问题。自定义组件属性LiveBindings

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) 

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

+0

“我成功了,只有一个属性”那么,你与其他财产的成功缺乏如何体现? – MartynA

+0

@martynA我会编辑问题并解释 – Edward

+0

@martynA我希望现在清楚 – Edward

回答

0

我没有得到更多的一个属性来使用视觉Livebindings。我得到它的工作通过:

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/

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