7

Delphi XE2 を使用して VCL win32 アプリケーションを作成しています。Delphi XE2 はライブ バインディングをサポートしています。サンプルの Biolife.xml を TClientDataSet インスタンスに読み込みます。

TEdit コントロールをデータセットの文字列フィールドにバインドできます: Species Name:

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

次に、Graphic フィールドを TImage コントロールにバインドしようとしています。

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

どうやら、うまくいきません。そうすることは可能ですか?

4

1 に答える 1

7

BindLinkVCLProjectデモ プロジェクトを見てみましょう。画像のバインディングも示されているので、この方法で行う必要があると思います ( SelfinSourceExpressionは blob フィールドを表します)。

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
于 2012-05-14T08:18:36.753 に答える