2012-05-14 3 views
7

Ich benutze Delphi XE2, um eine VCL Win32-Anwendung zu schreiben. Delphi XE2 unterstützt Live-Bindung. Ich lade die Probe Biolife.xml in eine TClientDataSet-Instanz.Wie verwende ich Live-Bindung, um Blob-Feld an TImage-Steuerelement zu binden?

ich in der Lage eine TEdit Kontrolle Datenmenge String-Feld zu binden: Art Name:

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

ich dann Grafik-Feld zu binden versucht, die Kontrolle Timage:

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

Offenbar tut es nicht Arbeit. Ist das möglich?

Antwort

7

Werfen Sie einen Blick in das Demo-Projekt BindLinkVCLProject. Es wird auch für das Bild eine Bindung gezeigt, so meine Vermutung ist, Sie müssen es auf diese Weise tun (die Self in SourceExpression stellt ein BLOB-Feld):

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 
Verwandte Themen