How to use real-time binding to bind blob field to TImage control?

I am using Delphi XE2 to write a win32 VCL application. Delphi XE2 supports direct binding. I am loading a sample of Biolife.xml into an instance of TClientDataSet.

I can associate a TEdit control with a dataset field: View name:

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

Then I try to associate a graphic field with a TImage control:

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

It does not seem to work. Is it possible to do this?

+7
source share
1 answer

Take a look at the BindLinkVCLProject demo project. Image linking is also shown, so I assume you need to do it this way ( Self in SourceExpression represents the blob field):

 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 
+7
source

All Articles