2016-06-12 76 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/

我不接受這個作爲一個答案,因爲這次沒解決這個問題。它提供了一個解決方法。