2012-05-14 9 views
7

मैं वीसीएल Win32 एप्लिकेशन लिखने के लिए डेल्फी एक्सई 2 का उपयोग कर रहा हूं। डेल्फी XE2 लाइव बाध्यकारी का समर्थन करते हैं। मैं एक TClientDataSet उदाहरण में नमूना Biolife.xml लोड।टिमेज नियंत्रण में ब्लाइंड फ़ील्ड को बांधने के लिए लाइव बाइंडिंग का उपयोग कैसे करें?

मैं डाटासेट की स्ट्रिंग क्षेत्र के लिए एक TEdit नियंत्रण आबद्ध कर सकता: प्रजाति का नाम:

object BindLinkEdit11: TBindLink 
    Category = 'Links' 
    SourceMemberName = 'Species Name' 
    ControlComponent = Edit1 
    SourceComponent = BindScopeDB1 
    ParseExpressions = <> 
    FormatExpressions = < 
    item 
     ControlExpression = 'Text' 
     SourceExpression = 'DisplayText' 
    end> 
    ClearExpressions = <> 
end 

मैं तो नियंत्रण TImage को ग्राफिक क्षेत्र बाध्य करने के लिए कोशिश कर रहा है:

object BindLinkImage11: TBindLink 
    Category = 'Links' 
    SourceMemberName = 'Graphic' 
    ControlComponent = Image1 
    SourceComponent = BindScopeDB1 
    ParseExpressions = <> 
    FormatExpressions = < 
    item 
     ControlExpression = 'Picture' 
     SourceExpression = 'Value' 
    end> 
    ClearExpressions = <> 
end 

जाहिर है, यह नहीं है काम। क्या ऐसा करना संभव है?

उत्तर

7

BindLinkVCLProject डेमो प्रोजेक्ट में एक नज़र डालें। वहाँ भी छवि के लिए एक बाध्यकारी दिखाया गया है, इसलिए मेरा अनुमान है कि आप इसे इस तरह से करने की जरूरत है (SourceExpression में Self एक ब्लॉब क्षेत्र का प्रतिनिधित्व करता है):

object BindLinkImageHandler: TBindLink 
    Category = 'Links' 
    SourceMemberName = 'Graphic' 
    ControlComponent = Image1 
    SourceComponent = BindScopeDB1 
    ParseExpressions = < 
    item 
     ControlExpression = 'Picture' 
     SourceExpression = 'Self' 
    end> 
    FormatExpressions = < 
    item 
     ControlExpression = 'Picture' 
     SourceExpression = 'Self' 
    end> 
    ClearExpressions = < 
    item 
     ControlExpression = 'Picture' 
     SourceExpression = 'nil' 
    end> 
end 
संबंधित मुद्दे