<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Jim Tierney</title>
	<atom:link href="http://blogs.embarcadero.com/jimtierney/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.embarcadero.com/jimtierney</link>
	<description></description>
	<pubDate>Tue, 11 Dec 2012 21:31:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en-US</language>
			<item>
		<title>XE3 Visual LiveBindings: User defined C++ objects</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/12/11/32002</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/12/11/32002#comments</comments>
		<pubDate>Tue, 11 Dec 2012 21:04:07 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=32002</guid>
		<description><![CDATA[In the previous post, TListBindSourceAdapter&#60;TContact&#62; is used to enable a list of Delphi TContact objects with LiveBindings, using the CreateAdapter event handler:
implementation

{$R *.dfm}

uses ContactsUnit, System.Generics.Collections;

procedure TForm1.AdapterBindSource1CreateAdapter(Sender: TObject;
  var ABindSourceAdapter: TBindSourceAdapter);
begin
  ABindSourceAdapter := TListBindSourceAdapter&#60;TContact&#62;.Create(Self,
    LoadContacts);
end;
C++ custom object can also be enabled for LiveBindings.   Here is a C++ version of TContact [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous post, TListBindSourceAdapter&lt;TContact&gt; is used to enable a list of Delphi TContact objects with LiveBindings, using the CreateAdapter event handler:</p>
<pre><span style="color: red"><strong>implementation</strong></span>

<span style="color: green"><em>{$R *.dfm}</em></span>

<span style="color: red"><strong>uses</strong></span> ContactsUnit<span style="color: blue;font-size: xx-small"><strong>,</strong></span> System<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Generics<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Collections<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>procedure</strong></span> TForm1<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>AdapterBindSource1CreateAdapter<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Sender<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TObject<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>var</strong></span> ABindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TBindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  ABindSourceAdapter <span style="color: blue;font-size: xx-small"><strong>:</strong></span><span style="color: blue;font-size: xx-small">=</span> TListBindSourceAdapter<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Self<span style="color: blue;font-size: xx-small"><strong>,</strong></span>
    LoadContacts<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>C++ custom object can also be enabled for LiveBindings.   Here is a C++ version of TContact for example:</p>
<pre>#pragma explicit_rtti methods <span style="color: blue;font-size: xx-small"><strong>(</strong></span>__published<span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: red"><strong>public</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span> properties <span style="color: blue;font-size: xx-small"><strong>(</strong></span>__published<span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: red"><strong>public</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span> fields<span style="color: blue;font-size: xx-small"><strong>(</strong></span>__published<span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: red"><strong>public</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span>
<span style="color: red"><strong>class</strong></span>  TContact<span style="color: blue;font-size: xx-small">:</span> <span style="color: red"><strong>public</strong></span> TObject
<span style="color: blue;font-size: xx-small"><strong>{</strong></span>
<span style="color: red"><strong>private</strong></span><span style="color: blue;font-size: xx-small">:</span>
  System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String firstname<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String lastname<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>public</strong></span><span style="color: blue;font-size: xx-small">:</span>
  __property System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String FirstName  <span style="color: blue;font-size: xx-small">=</span> <span style="color: blue;font-size: xx-small"><strong>{</strong></span>read<span style="color: blue;font-size: xx-small">=</span>firstname<span style="color: blue;font-size: xx-small"><strong>,</strong></span> write<span style="color: blue;font-size: xx-small">=</span>firstname<span style="color: blue;font-size: xx-small"><strong>}</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  __property System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String LastName  <span style="color: blue;font-size: xx-small">=</span> <span style="color: blue;font-size: xx-small"><strong>{</strong></span>read<span style="color: blue;font-size: xx-small">=</span>lastname<span style="color: blue;font-size: xx-small"><strong>,</strong></span> write<span style="color: blue;font-size: xx-small">=</span>lastname<span style="color: blue;font-size: xx-small"><strong>}</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>

  TContact<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span>
  <span style="color: blue;font-size: xx-small"><strong>{</strong></span>
    firstname <span style="color: blue;font-size: xx-small">=</span> <span style="color: purple">"&lt;first&gt;"</span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    lastname <span style="color: blue;font-size: xx-small">=</span> <span style="color: purple">"&lt;last&gt;"</span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: blue;font-size: xx-small"><strong>}</strong></span>

  TContact<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: red"><strong>const</strong></span> System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String first<span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: red"><strong>const</strong></span> System<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>String last<span style="color: blue;font-size: xx-small"><strong>)</strong></span>
  <span style="color: blue;font-size: xx-small"><strong>{</strong></span>
    firstname <span style="color: blue;font-size: xx-small">=</span> first<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    lastname <span style="color: blue;font-size: xx-small">=</span> last<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: blue;font-size: xx-small"><strong>}</strong></span>

<span style="color: blue;font-size: xx-small"><strong>}</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>The implementation of the CreateAdapter event is a little different than Delphi.  C++ can&#8217;t create a new generic type like TListBindSourceAdapter&lt;TContact&gt;.  The non-generic version of TListBindSourceAdapter is used instead.</p>
<pre><span style="color: red"><strong>void</strong></span> <span style="color: red"><strong>__fastcall</strong></span> TForm1<span style="color: blue;font-size: xx-small">:</span><span style="color: blue;font-size: xx-small">:</span>AdapterBindSource1CreateAdapter<span style="color: blue;font-size: xx-small"><strong>(</strong></span>TObject <span style="color: blue;font-size: xx-small">*</span>Sender<span style="color: blue;font-size: xx-small"><strong>,</strong></span> TBindSourceAdapter <span style="color: blue;font-size: xx-small">*</span><span style="color: blue;font-size: xx-small">&amp;</span>ABindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>)</strong></span>

<span style="color: blue;font-size: xx-small"><strong>{</strong></span>
  ABindSourceAdapter <span style="color: blue;font-size: xx-small">=</span> <span style="color: red"><strong>new</strong></span> TListBindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: red"><strong>this</strong></span><span style="color: blue;font-size: xx-small"><strong>,</strong></span>
    LoadContacts<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> __classid<span style="color: blue;font-size: xx-small"><strong>(</strong></span>TContact<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> true<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: blue;font-size: xx-small"><strong>}</strong></span></pre>
<p>Note that the class type is passed as a parameter.</p>
<p>A C++ sample project is available on source forge:<br />
https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/observers</p>
<p>The project is called CppListAdapterEventProject.dpr</p>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=32002&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_32002" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20User%20defined%20C%2B%2B%20objects&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F12%2F11%2F32002" id="akst_email_32002" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/12/11/32002/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: User defined objects</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/12/11/31961</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/12/11/31961#comments</comments>
		<pubDate>Tue, 11 Dec 2012 19:03:08 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31961</guid>
		<description><![CDATA[The adapter components TListBindSourceAdapter and TObjectBindSourceAdapter enable LiveBindings with user defined TObjects.
Here is a user defined TObject  for example.
type
  TContact = class
  private
    FFirstName: string;
    FLastName: string;
  public
    constructor Create; overload;
    constructor Create(const AFirstName, ALastName: string); overload;
    [...]]]></description>
			<content:encoded><![CDATA[<p>The adapter components TListBindSourceAdapter and TObjectBindSourceAdapter enable LiveBindings with user defined TObjects.</p>
<p>Here is a user defined TObject  for example.</p>
<pre><span style="color: red"><strong>type</strong></span>
  TContact <span style="color: blue;font-size: xx-small">=</span> <span style="color: red"><strong>class</strong></span>
  <span style="color: red"><strong>private</strong></span>
    FFirstName<span style="color: blue;font-size: xx-small"><strong>:</strong></span> <span style="color: red"><strong>string</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    FLastName<span style="color: blue;font-size: xx-small"><strong>:</strong></span> <span style="color: red"><strong>string</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>public</strong></span>
    <span style="color: red"><strong>constructor</strong></span> Create<span style="color: blue;font-size: xx-small"><strong>;</strong></span> overload<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>constructor</strong></span> Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: red"><strong>const</strong></span> AFirstName<span style="color: blue;font-size: xx-small"><strong>,</strong></span> ALastName<span style="color: blue;font-size: xx-small"><strong>:</strong></span> <span style="color: red"><strong>string</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span> overload<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> FirstName<span style="color: blue;font-size: xx-small"><strong>:</strong></span> <span style="color: red"><strong>string</strong></span> read FFirstName write FFirstName<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> LastName<span style="color: blue;font-size: xx-small"><strong>:</strong></span> <span style="color: red"><strong>string</strong></span> read FLastName write FLastName<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>

  <span style="color: red"><strong>function</strong></span> LoadContacts<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TList<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<pre><span style="color: red"><strong>implementation</strong></span>

<span style="color: red"><strong>function</strong></span> LoadContacts<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TList<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  Result <span style="color: blue;font-size: xx-small"><strong>:</strong></span><span style="color: blue;font-size: xx-small">=</span> TObjectList<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: green"><em>// TODO: Load data from file
</em></span>  Result<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Add<span style="color: blue;font-size: xx-small"><strong>(</strong></span>TContact<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: purple">'Adam'</span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: purple">'Barns'</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  Result<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Add<span style="color: blue;font-size: xx-small"><strong>(</strong></span>TContact<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: purple">'Chris'</span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: purple">'Decker'</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  Result<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Add<span style="color: blue;font-size: xx-small"><strong>(</strong></span>TContact<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: purple">'Emma'</span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: purple">'Fisk'</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>One way to use <span>TListBindSourceAdapter </span>is to instantiate the adapter at run time.  Drop a TAdapterBindSourceAdapter on the form and implement the CreateAdapter event as follows:</p>
<pre><span style="color: red"><strong>mplementation</strong></span>

<span style="color: green"><em>{$R *.dfm}</em></span>

<span style="color: red"><strong>uses</strong></span> ContactsUnit<span style="color: blue;font-size: xx-small"><strong>,</strong></span> System<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Generics<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Collections<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>procedure</strong></span> TForm1<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>AdapterBindSource1CreateAdapter<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Sender<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TObject<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>var</strong></span> ABindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TBindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  ABindSourceAdapter <span style="color: blue;font-size: xx-small"><strong>:</strong></span><span style="color: blue;font-size: xx-small">=</span> TListBindSourceAdapter<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Self<span style="color: blue;font-size: xx-small"><strong>,</strong></span>
    LoadContacts<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span><span style="font-weight: bold;color: red">i</span></pre>
<p>In the LiveBindings designer, we won&#8217;t see the fields for TContact because the TContact type is not known at design time.</p>
<p>Drop a TStringGrid on the form and connection the &#8216;*&#8217; of AdapterBindSource1 to StringGrid1.</p>
<p><a href="/files/2012/12/form1_7599.png"><img src="/files/2012/12/form1_7599.png" alt="" width="496" height="234" /></a></p>
<p>A navigator can be added by right clicking AdapterBindSource1 and choosing "Add Navigator".</p>
<p>The grid is populated when the application is run:</p>
<p><a href="/files/2012/12/form1_7602.png"><img src="/files/2012/12/form1_7602.png" alt="" width="367" height="266" /></a></p>
<p><a href="/files/2012/12/form1_7602.png"></a>A TDataGeneratorAdapter can be used to provide some fields to use at design time.  Add fields with the same name as the properties in TContact.  Set AdapterBindSource1.Adapter to DataGeneratorAdapter1.</p>
<p>The form shows sample data and the LiveBindings designer shows field names.</p>
<p><a href="/files/2012/12/form1_7605.png"><img src="/files/2012/12/form1_7605.png" alt="" width="494" height="545" /></a></p>
<p>To show this data at design time, the TDataGeneratorAdapter fields have FieldType: ftString and Generator: LoremIpsum.</p>
<p>The LiveBindings designer can be used to connect fields to controls.</p>
<p><a href="/files/2012/12/form1_7608.png"><img src="/files/2012/12/form1_7608.png" alt="" width="500" height="262" /></a></p>
<p>Note that an easy way to create a TLabeledEdit is to right click on FirstName then choose "Link to new control&#8230;".</p>
<p>At runtime, the TListBindSourceAdapter will be used instead of DataGeneratorAdapter1 because of the CreateAdapter event.</p>
<p><a href="/files/2012/12/form1_7611.png"><img src="/files/2012/12/form1_7611.png" alt="" width="492" height="315" /></a></p>
<p>Another way to use TListBindSourceAdapter is to register a custom component.  Instead of instantiating a TListBindSourceAdapter in the CreateAdapter event, the custom component is dropped from the tool palette.  A TDataGeneratorAdapter is not needed.</p>
<p><a href="/files/2012/12/form1_7614.png"><img src="/files/2012/12/form1_7614.png" alt="" width="500" height="635" /></a></p>
<p>The minimal code to for a custom adapter looks like this:</p>
<pre><span style="color: red"><strong>unit</strong></span> ContactsAdapter<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>interface</strong></span>

  <span style="color: red"><strong>uses</strong></span> ContactsUnit<span style="color: blue;font-size: xx-small"><strong>,</strong></span> Data<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Bind<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>ObjectScope<span style="color: blue;font-size: xx-small"><strong>,</strong></span> System<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Classes<span style="color: blue;font-size: xx-small"><strong>,</strong></span> System<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Generics<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Collections<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>type</strong></span>

  TContactsAdapter <span style="color: blue;font-size: xx-small">=</span> <span style="color: red"><strong>class</strong></span><span style="color: blue;font-size: xx-small"><strong>(</strong></span>TListBindSourceAdapter<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span>
  <span style="color: red"><strong>public</strong></span>
    <span style="color: red"><strong>constructor</strong></span> Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>AOwner<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TComponent<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span> <span style="color: red"><strong>override</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>implementation</strong></span>

<span style="color: green"><em>{ TContactsAdapter }</em></span>

<span style="color: red"><strong>constructor</strong></span> TContactsAdapter<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>AOwner<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TComponent<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  <span style="color: red"><strong>inherited</strong></span> Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>AOwner<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  SetList<span style="color: blue;font-size: xx-small"><strong>(</strong></span>LoadContacts<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>To register the custom adapter, you will need to create and register a package which contains the custom adapter component and TContact class.  You will also need and a Register method to register the custom component.</p>
<pre><span style="color: red"><strong>unit</strong></span> ContactsAdapterReg<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>interface</strong></span>

<span style="color: red"><strong>procedure</strong></span> Register<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>implementation</strong></span>

<span style="color: red"><strong>uses</strong></span> System<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Classes<span style="color: blue;font-size: xx-small"><strong>,</strong></span> ContactsAdapter<span style="color: blue;font-size: xx-small"><strong>,</strong></span> ContactsAdapter2<span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>procedure</strong></span> Register<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  RegisterComponents<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: purple">'Test'</span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: blue;font-size: xx-small"><strong>[</strong></span>TContactsAdapter<span style="color: blue;font-size: xx-small"><strong>]</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>

<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span></pre>
<p>A complete implementation of a custom adapter publishes properties and methods:</p>
<pre>  TContactsAdapter2 <span style="color: blue;font-size: xx-small">=</span> <span style="color: red"><strong>class</strong></span><span style="color: blue;font-size: xx-small"><strong>(</strong></span>TListBindSourceAdapter<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span>
  <span style="color: red"><strong>public</strong></span>
    <span style="color: red"><strong>constructor</strong></span> Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>AOwner<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TComponent<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span> <span style="color: red"><strong>override</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  published
    <span style="color: red"><strong>property</strong></span> OnBeforeSetList<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnAfterSetList<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnListAppend<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnListDelete<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnListInsert<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnCreateItemInstance<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnInitItemInstance<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> Options<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AutoEdit<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeOpen<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterOpen<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeClose<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterClose<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeInsert<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterInsert<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeEdit<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterEdit<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforePost<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterPost<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeCancel<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterCancel<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeDelete<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterDelete<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeScroll<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterScroll<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeRefresh<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterRefresh<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeApplyUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterApplyUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> BeforeCancelUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> AfterCancelUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnDeleteError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnInsertError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnEditError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnPostError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnApplyUpdatesError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnCancelUpdatesError<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnApplyUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnCancelUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
    <span style="color: red"><strong>property</strong></span> OnHasUpdates<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>TObjectBindSourceAdapter is used instead of TListBindSourceAdapter to bind to a single object, rather than a list of objects.</p>
<p>TObjectBindSourceAdapter is instantiated like this:</p>
<pre><span style="color: red"><strong>procedure</strong></span> TForm1<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>AdapterBindSource1CreateAdapter<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Sender<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TObject<span style="color: blue;font-size: xx-small"><strong>;</strong></span>
  <span style="color: red"><strong>var</strong></span> ABindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>:</strong></span> TBindSourceAdapter<span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>begin</strong></span>
  ABindSourceAdapter <span style="color: blue;font-size: xx-small"><strong>:</strong></span><span style="color: blue;font-size: xx-small">=</span> TObjectBindSourceAdapter<span style="color: blue;font-size: xx-small">&lt;</span>TContact<span style="color: blue;font-size: xx-small">&gt;</span><span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span>Self<span style="color: blue;font-size: xx-small"><strong>,</strong></span>
    TContact<span style="color: blue;font-size: xx-small"><strong><span style="color: blue;font-size: xx-small"><strong>.</strong></span></strong></span>Create<span style="color: blue;font-size: xx-small"><strong>(</strong></span><span style="color: purple">'Adam'</span><span style="color: blue;font-size: xx-small"><strong>,</strong></span> <span style="color: purple">'Barns'</span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>)</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span>
<span style="color: red"><strong>end</strong></span><span style="color: blue;font-size: xx-small"><strong>;</strong></span></pre>
<p>At run time, there is only a single row of data.</p>
<p><a href="/files/2012/12/form1_7617.png"><img src="/files/2012/12/form1_7617.png" alt="" width="355" height="314" /></a></p>
<p>Source forge samples</p>
<p>https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/observers</p>
<ul>
<li>ContactsAdapterPackage.dpk
<ul>
<li>Implements a custom TListBindSourceAdapter component</li>
</ul>
</li>
<li>ListAdapterEventProject.dpr
<ul>
<li>Demonstrates  TAdapterBindSource.CreateAdapter event</li>
</ul>
</li>
<li>ListAdapterComponentProject.dpr
<ul>
<li>Demonstrates custom TListBindSourceAdapter component</li>
</ul>
</li>
<li>Project: CppListAdapterEventProject.dpr
<ul>
<li>Cpp project demonstrates  TAdapterBindSource.CreateAdapter event</li>
</ul>
</li>
</ul>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31961&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31961" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20User%20defined%20objects&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F12%2F11%2F31961" id="akst_email_31961" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/12/11/31961/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Samples</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/21/31944</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/21/31944#comments</comments>
		<pubDate>Mon, 22 Oct 2012 05:35:23 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31944</guid>
		<description><![CDATA[Here is a summary of the samples which accompany my XE3 VLB posts.  The samples are grouped by Sourceforge locations.

Observers (post)

VclSampleObservableControls.dpk - Implements an observable TTrackBar
LinkTrackbarToField.dpr - TObservableTrackBar project


Actions (post)

Navigate using actions and TSpeedButton

Vcl\LiveBindingsActionsProtoProject.dpr
Fmx\FmxLiveBindingsActionsProtoProject.dpr
Vcl\LiveBindingsActionCDSProject.dpr
Fmx\FmxLiveBindingsActionsCDSProject.dpr




ListControls (post1, post2)

ListBoxVCL.dpr - Link a TListBox to a field
SimpleListView.dpr - Link a TListView to a field
LiveViewColumns.dpr - Link a TListView to a [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a summary of the samples which accompany my XE3 VLB posts.  The samples are grouped by Sourceforge locations.</p>
<ul>
<li><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/observers/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/observers/vcl">Observers</a> (<a title="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653" href="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653">post</a>)
<ul>
<li>VclSampleObservableControls.dpk - Implements an observable TTrackBar</li>
<li>LinkTrackbarToField.dpr - TObservableTrackBar project</li>
</ul>
</li>
<li><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/actions" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/actions">Actions</a> (<a title="http://blogs.embarcadero.com/jimtierney/2012/10/03/31721" href="http://blogs.embarcadero.com/jimtierney/2012/10/03/31721">post</a>)
<ul>
<li>Navigate using actions and TSpeedButton
<ul>
<li>Vcl\LiveBindingsActionsProtoProject.dpr</li>
<li>Fmx\FmxLiveBindingsActionsProtoProject.dpr</li>
<li>Vcl\LiveBindingsActionCDSProject.dpr</li>
<li>Fmx\FmxLiveBindingsActionsCDSProject.dpr</li>
</ul>
</li>
</ul>
</li>
<li><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl">ListControls</a> (<a title="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824" href="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824">post1</a>, <a title="http://blogs.embarcadero.com/jimtierney/2012/10/21/31925" href="http://blogs.embarcadero.com/jimtierney/2012/10/21/31925">post2</a>)
<ul>
<li>ListBoxVCL.dpr - Link a TListBox to a field</li>
<li>SimpleListView.dpr - Link a TListView to a field</li>
<li>LiveViewColumns.dpr - Link a TListView to a field and fill multiple columns</li>
</ul>
</li>
<li><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl">Lookup</a>s (<a title="http://blogs.embarcadero.com/jimtierney/2012/10/15/31834" href="http://blogs.embarcadero.com/jimtierney/2012/10/15/31834">post1</a>, <a title="http://blogs.embarcadero.com/jimtierney/2012/10/20/31892" href="http://blogs.embarcadero.com/jimtierney/2012/10/20/31892">post2</a>)
<ul>
<li>LookupListBoxVCL.dpr - Configure TListBox as a lookup list</li>
<li>LookupEditVCL.dpr - Configure a TLabeledEdit as a lookup control</li>
<li>LookupLabelVCL.dpr - Configure TLabel.Caption as a lookup property</li>
</ul>
</li>
</ul>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31944&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31944" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Samples&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F21%2F31944" id="akst_email_31944" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/21/31944/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: TListView</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/21/31925</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/21/31925#comments</comments>
		<pubDate>Sun, 21 Oct 2012 21:30:04 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31925</guid>
		<description><![CDATA[A previous post uses TListBox to demonstrate how to link fields to a list control.  The same steps can be used to link fields to TListView.
Here is a sample form with a TListView:

To improve the TListView appearance, the ListView1.ViewStyle property has been set to vsList.
The LiveBindings designer looks like this:

A project containing this form can [...]]]></description>
			<content:encoded><![CDATA[<p>A <a title="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824" href="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824">previous post</a> uses TListBox to demonstrate how to link fields to a list control.  The same steps can be used to link fields to TListView.</p>
<p>Here is a sample form with a TListView:</p>
<p><a href="/files/2012/10/form1_7181.png"><img src="/files/2012/10/form1_7181.png" alt="" width="469" height="307" /></a></p>
<p>To improve the TListView appearance, the ListView1.ViewStyle property has been set to vsList.</p>
<p>The LiveBindings designer looks like this:</p>
<p><a href="/files/2012/10/form1_7184.png"><img src="/files/2012/10/form1_7184.png" alt="" width="451" height="373" /></a></p>
<p>A project containing this form can be downloaded <a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl/" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl/">here</a>.  See SimpleListView.dpr.</p>
<p>The LiveBindings designer also supports TListView columns.  Follow these steps to add columns to ListView1:</p>
<ol>
<li>Select ListView1</li>
<li>View the object inspector</li>
<li>Use the object inspector to change properties of ListView1
<ul>
<li>Change ListView1.ViewStyle to vsReport</li>
<li>Click on the "&#8230;" to the right of the ListView1.Columns property to show the columns editor</li>
<li>Use the columns editor to add three columns</li>
</ul>
</li>
</ol>
<p>The LiveBindings designer shows additional member for ListView1:</p>
<div><a href="/files/2012/10/form1_7187.png"><img src="/files/2012/10/form1_7187.png" alt="" width="500" height="414" /></a></div>
<p>"Item.Caption" is the only member linked to a field, so the form looks like this:</p>
<p><a href="/files/2012/10/form1_7190.png"><img src="/files/2012/10/form1_7190.png" alt="" width="468" height="306" /></a></p>
<p>To improve the TListView appearance,  use the object inspector to set column captions and widths.</p>
<p>To fill the additional columns, add two fields to TPrototypeBindSourceFill and connected the new fields to the "SubItems" members.</p>
<p>After these changes, the form looks like this:</p>
<p><a href="/files/2012/10/form1_7196.png"><img src="/files/2012/10/form1_7196.png" alt="" width="467" height="305" /></a></p>
<p>The design looks like this:</p>
<p><a href="/files/2012/10/form1_7193.png"><img src="/files/2012/10/form1_7193.png" alt="" width="500" height="414" /></a></p>
<p>A project containing this form can be downloaded <a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl/" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/listcontrols/vcl/">here</a>.  See ListViewColumns.dpr.</p>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31925&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31925" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20TListView&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F21%2F31925" id="akst_email_31925" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/21/31925/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Lookup controls</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/20/31892</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/20/31892#comments</comments>
		<pubDate>Sun, 21 Oct 2012 06:00:53 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31892</guid>
		<description><![CDATA[A lookup control displays a value that is different from the actual field value.
In this post, I modify the sample application built in the previous post about lookup lists.
The lookup list example ended with this design:

 The lookup list ended with this form:

To demonstrate a lookup control, this form is changed so that the TLabeledEdit [...]]]></description>
			<content:encoded><![CDATA[<p>A lookup control displays a value that is different from the actual field value.</p>
<p>In this post, I modify the sample application built in the previous <a title="http://blogs.embarcadero.com/jimtierney/2012/10/15/31834" href="http://blogs.embarcadero.com/jimtierney/2012/10/15/31834">post</a> about lookup lists.</p>
<p>The lookup list example ended with this design:</p>
<p><a href="/files/2012/10/form1_7098.png"><img src="/files/2012/10/form1_7098.png" alt="" width="500" height="339" /></a></p>
<p><a href="/files/2012/10/form1_7098.png"></a> The lookup list ended with this form:</p>
<p><a href="/files/2012/10/form1_7095.png"><img src="/files/2012/10/form1_7095.png" alt="" width="489" height="300" /></a></p>
<p>To demonstrate a lookup control, this form is changed so that the TLabeledEdit displays a color name instead of a color number.  For example, "DarkGreen" is displayed instead of "25600".</p>
<p>To accomplish this,  a "LookupDataSource" is configured in the object inspector.</p>
<p>First, show the LiveBindings designer by selecting the "View/LiveBindings designer" command.  Click the line connecting LabeledEditColor1.Text and PrototypeBindSource1.Text to select the binding component.</p>
<p><a href="/files/2012/10/form1_7158.png"><img src="/files/2012/10/form1_7158.png" alt="" width="496" height="357" /></a></p>
<p>The properties of LinkControlToField1 are shown in the object inspector:</p>
<p><a href="/files/2012/10/form1_7161.png"><img src="/files/2012/10/form1_7161.png" alt="" width="302" height="431" /></a></p>
<p>Using the object inspector, change properties of LinkControlToField1 to use a "LookupDataSource":</p>
<ol>
<li>Set "LookupDataSource" to PrototypeBindSourceFill</li>
<li>Set "LookupKeyFieldName" to "AColor"</li>
<li>Set "LookupValueFieldName" to "AColorName"</li>
</ol>
<div><a href="/files/2012/10/form1_7173.png"><img src="/files/2012/10/form1_7173.png" alt="" width="302" height="430" /></a></div>
<p>After configuring the "LookupDataSource", the LiveBindings designer shows the relationship between the data sources and the TLabeledEdit as follows.</p>
<div><a href="/files/2012/10/form1_7164.png"><img src="/files/2012/10/form1_7164.png" alt="" width="500" height="396" /></a></div>
<p>The form designer looks like this, with the TLabeledEdit displaying a color name rather a color number:</p>
<div><a href="/files/2012/10/form1_7170.png"><img src="/files/2012/10/form1_7170.png" alt="" width="488" height="300" /></a></div>
<p>The source for this sample is available <a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl">here</a>.  See LookupEditVCL.dpr.</p>
<p>A "LookupDataSource" can also be used with links between component properties and fields.  For example, in this form, the property TLabel.Caption displays a color name using a lookup.</p>
<div><a href="/files/2012/10/form1_7176.png"><img src="/files/2012/10/form1_7176.png" alt="" width="488" height="300" /></a></div>
<p>The "LookupDataSource" for a TLinkPropertyToField component is configured using the object inspector, just as the TLinkControlToField component is configured.</p>
<div><a href="/files/2012/10/form1_7179.png"><img src="/files/2012/10/form1_7179.png" alt="" width="295" height="296" /></a></div>
<div>
<p>The source for this sample is available <a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl">here</a>.  See LookupLabelVCL.dpr.</div>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31892&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31892" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Lookup%20controls&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F20%2F31892" id="akst_email_31892" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/20/31892/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Link a field to a lookup list</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/15/31834</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/15/31834#comments</comments>
		<pubDate>Mon, 15 Oct 2012 17:00:27 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31834</guid>
		<description><![CDATA[A lookup list is used when the actual data values are not meaningful to users.  A lookup list populates a list control with display values, instead of actual data values.
We can configure two TPrototypeBindSource components to represent a situation that calls for a lookup list. These steps differ from the previous post by using [...]]]></description>
			<content:encoded><![CDATA[<div>A lookup list is used when the actual data values are not meaningful to users.  A lookup list populates a list control with display values, instead of actual data values.</div>
<div>We can configure two TPrototypeBindSource components to represent a situation that calls for a lookup list. These steps differ from the previous <a title="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824" href="http://blogs.embarcadero.com/jimtierney/2012/10/14/31824">post</a> by using a Colors field in addition to a ColorsName field.  The Colors field holds a numeric color value.</div>
<div>First, create the "DataSource".</div>
<ol>
<li>New VCL application</li>
<li>Drop a TPrototypeBindSource on the form</li>
<li>In the object inspector, set PrototypeBindSource1.RecordCount to 10</li>
<li>Add a <strong>Colors</strong> field to the TPrototypeBindSource</li>
</ol>
<p>Next, create the "FillDataSource"</p>
<ol>
<li>Drop a second TPrototypeBindSource on the form</li>
<li>In the object inspector, rename to "PrototypeBindSourceFill"</li>
<li>Add <strong>Colors and ColorsNames</strong> fields to the PrototypeBindSourceFill</li>
<li>Uncheck "Shuffle" and "Repeat" to generate an ordered list of unique values</li>
</ol>
<div><a href="/files/2012/10/form1_7074.png"><img src="/files/2012/10/form1_7074.png" alt="" width="381" height="466" /></a></div>
<p>Drop a TListBox on the form</p>
<div><a href="/files/2012/10/form1_7077.png"><img src="/files/2012/10/form1_7077.png" alt="" width="489" height="301" /></a></div>
<p>Choose the "View/LiveBindings designer" command to show the LiveBindings designer:</p>
<div><a href="/files/2012/10/form1_7080.png"><img src="/files/2012/10/form1_7080.png" alt="" width="429" height="288" /></a></div>
<p>For clarity, rename PrototypeBindSourceFill fields to AColor and AColorName.  Select each field in the LiveBindings designer and use the object inspector to type in a  new name:</p>
<div><a href="/files/2012/10/form1_7083.png"><img src="/files/2012/10/form1_7083.png" alt="" width="500" height="255" /></a></div>
<p>In order to create a lookup list, the "FillDataSource" must provide a "ValueField" and a "DisplayField".  These two fields are used to build a dictionary which can be used to lookup a display value for each actual value.<br />
In this example, AColor is the "ValueField" and AColorName is the "DisplayField".   A numeric color value in AColor can be used to lookup a color name in AColorName.</p>
<p>Make three connections in the LiveBindings designer to create a lookup list:</p>
<div>
<ol>
<li>Connect "PrototypeBindSource1.Color1" to "ListBox1.SelectedText"</li>
<li>Connect "PrototypeBindSourceFill.AColorName" to "ListBox1.ItemText".</li>
<li>Connect "PrototypeBindSourceFill.AColor" to "ListBox1.LookupData".</li>
</ol>
</div>
<div><a href="/files/2012/10/form1_7086.png"><img src="/files/2012/10/form1_7086.png" alt="" width="452" height="287" /></a></div>
<p>ListBox1 is populated in the form designer:</p>
<div><a href="/files/2012/10/form1_7089.png"><img src="/files/2012/10/form1_7089.png" alt="" width="489" height="301" /></a></div>
<div>
<p>"Darkgreen" is selected because the value of the "Colors1" field in the first record of PrototypeBindSource1 is paired with "Darkgreen" in PrototypeBindSourceFill.</p>
<p>Right click on PrototypeBindSource1 and choose "Add Navigator".  Now the app is ready to run.</p></div>
<div><a href="/files/2012/10/form1_7095.png"><img src="/files/2012/10/form1_7095.png" alt="" width="489" height="300" /></a></div>
<div>
<p>I&#8217;ve also added a TLabeledEdit and a TShape.</p>
<p>The TLabeledEdit shows the value of PrototypeBindSource1.Color1 as a number.</p>
<p>The TShape shows the value of PrototypeBindSource1.Color1 field as a color.</p>
<p>Here is the complete design:</p></div>
<div><a href="/files/2012/10/form1_7098.png"><img src="/files/2012/10/form1_7098.png" alt="" width="500" height="339" /></a></div>
<div>
<p><span>The source for this sample is available </span><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/lookups/vcl">here</a><span>.  See LookupListBoxVCL.dpr.</span></div>
<div><span><br />
</span></div>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31834&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31834" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Link%20a%20field%20to%20a%20lookup%20list&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F15%2F31834" id="akst_email_31834" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/15/31834/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Link a list control to a field</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/14/31824</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/14/31824#comments</comments>
		<pubDate>Sun, 14 Oct 2012 18:30:34 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31824</guid>
		<description><![CDATA[List controls can be linked to data source fields.   TListBox, TComboBox and VCL TListView are examples of list controls.  When a list control is linked to a data source field, the selected item in the list control corresponds to the value of the data source field.   To change the value [...]]]></description>
			<content:encoded><![CDATA[<p>List controls can be linked to data source fields.   TListBox, TComboBox and VCL TListView are examples of list controls.  When a list control is linked to a data source field, the selected item in the list control corresponds to the value of the data source field.   To change the value of the field, the user selects a different item in the list control.</p>
<p>Typically, two data sources are used with a list control.  One data source provides the value to select in the list control.   The other data source provides the values to fill the list control.  LiveBindings uses the terms "DataSource" and "FillDataSource".</p>
<p>The TPrototypeBindSource is a simple way to create data sources.  We can configure one TPrototypeBindSource as the "DataSource" and another as the "FillDataSource".</p>
<p>First, create the "DataSource".</p>
<ol>
<li>New VCL application</li>
<li>Drop a TPrototypeBindSource on the form</li>
<li>In the object inspector, set PrototypeBindSource1.RecordCount to 10</li>
<li>Add a ColorsName field to the TPrototypeBindSource (See this <span style="color: #546188"><a title="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653/#prototypebindsource" href="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653/#prototypebindsource">post</a> </span><span>for instructions on adding fields)</span></li>
</ol>
<p>Next, create the "FillDataSource"</p>
<ol>
<li>Drop a second TPrototypeBindSource on the form</li>
<li>In the object inspector, rename to "PrototypeBindSourceFill"</li>
<li>Add a ColorsName field to the PrototypeBindSourceFill</li>
<li>Name the field "AColorsName"</li>
<li>Uncheck "Shuffle" and "Repeat" to generate an ordered list of unique values</li>
</ol>
<div><a href="/files/2012/10/form1_7050.png"><img src="/files/2012/10/form1_7050.png" alt="" width="380" height="463" /></a></div>
<p>Drop a TListBox on the form.</p>
<div><a href="/files/2012/10/form1_7053.png"><img src="/files/2012/10/form1_7053.png" alt="" width="444" height="282" /></a></div>
<p>Choose the "View/LiveBindings designer" command to show the LiveBindings designer:</p>
<div><a href="/files/2012/10/form1_7056.png"><img src="/files/2012/10/form1_7056.png" alt="" width="500" height="267" /></a></div>
<p>In the LiveBindings designer, ListBox1 is shown with three members: "SelectedValue", "Item.Text", and "Item.LookupData".</p>
<p>Connect "PrototypeBindSource1.ColorsName1" to "ListBox1.SelectedValue".  Connect "PrototypeBindSourceFill.AColorsName" to "ListBox1.Item.Text".</p>
<div><a href="/files/2012/10/form1_7059.png"><img src="/files/2012/10/form1_7059.png" alt="" width="500" height="267" /></a></div>
<p>ListBox1 is populated in the form designer.</p>
<div><a href="/files/2012/10/form1_7062.png"><img src="/files/2012/10/form1_7062.png" alt="" width="444" height="282" /></a></div>
<p>"Darkgreen" is selected because the value of the "ColorsName1" field in the first record of PrototypeBindSource1 is "Darkgreen".</p>
<p>Right click on PrototypeBindSource1 and choose "Add Navigator".  Now the app is ready to run.</p>
<div><a href="/files/2012/10/form1_7065.png"><img src="/files/2012/10/form1_7065.png" alt="" width="444" height="282" /></a></div>
<p>The selection in the list box will change as the user changes the active record using the navigator.<br />
I&#8217;ve added a TLabeledEdit to show how selecting a value in the listbox changes the value of the field.</p>
<p>Here is the complete design:</p>
<div><a href="/files/2012/10/form1_7071.png"><img src="/files/2012/10/form1_7071.png" alt="" width="500" height="302" /></a></div>
<p>My next post will describe how to use the "Item.LookupData" member to create a lookup list.</p>
<div><a href="http://blogs.embarcadero.com/files/2012/10/form1_6752.png"></a></div>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31824&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31824" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Link%20a%20list%20control%20to%20a%20field&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F14%2F31824" id="akst_email_31824" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/14/31824/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Hiding and showing components</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/03/31801</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/03/31801#comments</comments>
		<pubDate>Thu, 04 Oct 2012 00:55:26 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31801</guid>
		<description><![CDATA[This post describes how to specify which components show on the LiveBindings designer.
Hide/Show Component Classes
To reduce clutter, the LiveBindings designer hides many classes of components.  The default settings show most visual control classes and  hide most non-visual components classes except for data sources.
The settings are in Tools/Options/LiveBindings:

If there is a component class that [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to specify which components show on the LiveBindings designer.</p>
<h3>Hide/Show Component Classes</h3>
<p>To reduce clutter, the LiveBindings designer hides many classes of components.  The default settings show most visual control classes and  hide most non-visual components classes except for data sources.</p>
<p>The settings are in Tools/Options/LiveBindings:</p>
<p><a href="/files/2012/10/form1_6875.png"><img src="/files/2012/10/form1_6875.png" alt="" width="500" height="128" /></a></p>
<p>If there is a component class that you always want to see on the LiveBindings designer, add it to the "Included Items:" field. For example, if you use FireMonkey 3D controls then you&#8217;ll probably want to add "TControl3D".</p>
<p><a href="/files/2012/10/form1_6881.png"><img src="/files/2012/10/form1_6881.png" alt="" width="500" height="128" /></a></p>
<p>This setting will cause components derived  from TControl3D,  like TText3D,  to show in the LiveBindings designer.</p>
<h3>Hide/Show Component instances</h3>
<p>To hide a specific component, right click on the component in the LiveBindings designer and choose "Hide Elements(s)".</p>
<p><a href="/files/2012/10/form1_6886.png"><img src="/files/2012/10/form1_6886.png" alt="" width="500" height="263" /></a></p>
<p>To show a hidden component, use the object inspector to change the LiveBindings Designer properties for the component.</p>
<p><a href="/files/2012/10/form1_6889.png"><img src="/files/2012/10/form1_6889.png" alt="" width="365" height="295" /></a></p>
<p>LiveBindings Designer properties for a components supersede the settings for the component&#8217;s class in Tools/Options. LiveBindings Designer properties for components are saved in  unitname.vlb file  with other LiveBindings designer state information.</p>
<h3>Link to TForm</h3>
<p>The LiveBindings designer can be configured to show the TCustomForm class, but the form instance will not show in the designer until the form is linked.</p>
<p>To configure the LiveBindings designer to show TCustomForm, prepend the "Included Items:" setting with "TCustomForm;".</p>
<p><a href="/files/2012/10/form1_6916.png"><img src="/files/2012/10/form1_6916.png" alt="" width="500" height="126" /></a></p>
<p>A link can be created to a TLabel and then modified using the object inspector.</p>
<ol>
<li>New FireMonkey application</li>
<li>Drop a TEdit and TLabel on the form</li>
<li>In the LiveBindings designer, link TEdit.Text to TLabel.Text</li>
<li>Select the link component by clicking on the line between the components</li>
<li>In the object inspector, change the "ComponentProperty" property to blank</li>
<li>Change the "Component" property to "Form1"</li>
<li>Change the "ComponentProperty" property to "Caption"</li>
<li>Delete the TLabel component</li>
</ol>
<p><a href="/files/2012/10/form1_6913.png"><img src="/files/2012/10/form1_6913.png" alt="" width="500" height="251" /></a></p>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31801&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31801" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Hiding%20and%20showing%20components&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F03%2F31801" id="akst_email_31801" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/03/31801/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Actions</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/03/31721</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/03/31721#comments</comments>
		<pubDate>Wed, 03 Oct 2012 21:30:19 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31721</guid>
		<description><![CDATA[LiveBindings actions are new in XE3.  If you are not familiar with actions, follow this link.  LiveBindings actions correspond to the buttons on the TBindNavigator such as First, Next, Edit, Post, and Delete.
Steps for creating a speed button which uses a LiveBindings action:

Drop a  TPrototypeBindSource on the form and add fields.  See this post.
Drop a  TActionList
Drop a TSpeedButton
In [...]]]></description>
			<content:encoded><![CDATA[<p>LiveBindings actions are new in XE3.  If you are not familiar with actions, follow this <a title="http://docwiki.embarcadero.com/RADStudio/en/What_Is_an_Action" href="http://docwiki.embarcadero.com/RADStudio/en/What_Is_an_Action">link</a>.  LiveBindings actions correspond to the buttons on the TBindNavigator such as First, Next, Edit, Post, and Delete.</p>
<p>Steps for creating a speed button which uses a LiveBindings action:</p>
<ol>
<li>Drop a  TPrototypeBindSource on the form and add fields.  See this <a title="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653/#prototypebindsource" href="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653/#prototypebindsource">post</a>.</li>
<li>Drop a  TActionList</li>
<li>Drop a TSpeedButton</li>
<li>In the object inspector, click the down arrow next to the SpeedButton1.Action property.
<ul>
<li>Choose "New Standard Action/LiveBindings/TBindNavigateNext"</li>
</ul>
</li>
<li>Set the BindNavigateNext1.DataSource property to PrototypeBindSource1.</li>
</ol>
<p>Here is a FireMonkey form using LiveBindings actions:</p>
<div><a href="/files/2012/10/form1_6752.png"><img src="/files/2012/10/form1_6752.png" alt="" width="445" height="211" /></a></div>
<p>VCL:</p>
<div><a href="/files/2012/10/form1_6749.png"><img src="/files/2012/10/form1_6749.png" alt="" width="400" height="217" /></a></div>
<div>
<p>Tips</p>
<div>
<ul>
<li>To use a TClientDataSet, instead of a TPrototypeBindSource, you will also need a TBindSourceDB.  Set the TBindSourceDB.DataSet property to the TClientDataSet.  Set the action&#8217;s DataSource property to the TBindSourceDB.</li>
<li>If a speed button stays disabled,  check that the action&#8217;s DataSource property is set.</li>
</ul>
<div>
<p>Samples</p>
<div><a title="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/actions" href="https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/actions">https://radstudiodemos.svn.sourceforge.net/svnroot/radstudiodemos/branches/RadStudio_XE3/LiveBindings/actions</a></div>
</div>
</div>
</div>
<p style="padding-left: 30px">
<p style="padding-left: 30px">
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31721&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31721" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Actions&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F03%2F31721" id="akst_email_31721" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/03/31721/feed</wfw:commentRss>
		</item>
		<item>
		<title>XE3 Visual LiveBindings: Link controls to component properties</title>
		<link>http://blogs.embarcadero.com/jimtierney/2012/10/03/31745</link>
		<comments>http://blogs.embarcadero.com/jimtierney/2012/10/03/31745#comments</comments>
		<pubDate>Wed, 03 Oct 2012 20:30:11 +0000</pubDate>
		<dc:creator>Jim Tierney</dc:creator>
		
		<category><![CDATA[Data Binding]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[LiveBindings]]></category>

		<category><![CDATA[Visual LiveBindings]]></category>

		<category><![CDATA[XE3]]></category>

		<guid isPermaLink="false">http://blogs.embarcadero.com/jimtierney/?p=31745</guid>
		<description><![CDATA[Simple controls can be linked to component properties.   TEdit is an example of a simple control.  TLabel.Text is an example of a component property.   Controls can be linked to most public properties of any component on a form.
Link controls to component properties in the LiveBindings designer
After a TEdit and TLabel are dropped on [...]]]></description>
			<content:encoded><![CDATA[<p>Simple controls can be linked to component properties.   TEdit is an example of a simple control.  TLabel.Text is an example of a component property.   Controls can be linked to most public properties of any component on a form.</p>
<h3>Link controls to component properties in the LiveBindings designer</h3>
<p>After a TEdit and TLabel are dropped on a FireMonkey form, the LiveBindings designer represents the TEdit with the member "Text" and the TLabel with the member "Text":</p>
<p><a href="/files/2012/10/form1_6775.png"><img src="/files/2012/10/form1_6775.png" alt="" width="258" height="197" /></a></p>
<p>The LiveBindings designer can be used to connect these members:</p>
<p><a href="/files/2012/10/form1_6777.png"><img src="/files/2012/10/form1_6777.png" alt="" width="258" height="197" /></a></p>
<p>In the form you will notice that the value of the label has been copied to the edit.  When the link is initialized, the component property value is copied to the control to give both members the same value to start off.  After initialization, the control value will be copied to the component property whenever the user modifies the edit and presses enter, or leaves the edit.</p>
<p><a href="/files/2012/10/form1_6779.png"><img src="/files/2012/10/form1_6779.png" alt="" width="262" height="147" /></a></p>
<p>In the LiveBindings designer, the line between the components represents a link component.  Click the line to select the component in the object inspector.</p>
<p><a href="/files/2012/10/form1_6784.png"><img src="/files/2012/10/form1_6784.png" alt="" width="500" height="232" /></a></p>
<p><a href="/files/2012/10/form1_6784.png"></a>The AutoActivate property indicates whether this link should be initialized when the application is run.  This property also activates the link at design time.</p>
<p>The InitializeControlValue property can be unchecked to prevent the component property value from being copied to the control when the link is initialized.</p>
<h3>Multiple links</h3>
<p>The LiveBindings designer can be used to connect a single control to multiple component properties.</p>
<p><a href="/files/2012/10/form1_6787.png"><img src="/files/2012/10/form1_6787.png" alt="" width="365" height="264" /></a></p>
<h3>Links not permitted</h3>
<p>LiveBindings does not permit links between component properties, such as Label1.Text and Button1.Text.</p>
<p>The LiveBindings designer highlights members when a link is not permitted.</p>
<p><a href="/files/2012/10/form1_6790.png"><img src="/files/2012/10/form1_6790.png" alt="" width="346" height="303" /></a></p>
<p>LiveBindings does not permit a direct link between two user input control,  such as Edit1.Text to Edit2.Text. To achieve the same effect, link both controls to a TPrototypeBindSource field.</p>
<p><a href="/files/2012/10/form1_6793.png"><img src="/files/2012/10/form1_6793.png" alt="" width="416" height="213" /></a></p>
<p>The links shown in this image will keep all "Text" members synchronized when the user modifies one of the edits then presses Enter, or exits the edit.</p>
<p>The TPrototypeBindSource.RecordCount property can be set to "1" when using a TPrototypeBindSource to provide an intermediate field.</p>
<h3>Linking to other properties</h3>
<p>To show additional component properties in the LiveBindings designer, click "&#8230;" to open the "Bindable Members" dialog.</p>
<p><a href="/files/2012/10/form1_6860.png"><img src="/files/2012/10/form1_6860.png" alt="" width="463" height="232" /></a></p>
<p>This dialog populates a list with properties found by scanning the type information of the component.    Some properties are skipped because the type, such as sets, is not supported in LiveBindings expressions.  Put a check mark next to a property to show it in the LiveBindings designer.</p>
<p>Connecting from a control to "&#8230;" is another way to get at additional properties.  For example, drag from "IsChecked" to "&#8230;" and select the "WordWrap" property.</p>
<p><a href="/files/2012/10/form1_6863.png"><img src="/files/2012/10/form1_6863.png" alt="" width="500" height="594" /></a></p>
<h3>LiveBindings-enable component properties</h3>
<p>LiveBindings uses <a title="http://docwiki.embarcadero.com/RADStudio/en/Working_with_RTTI_Index" href="http://docwiki.embarcadero.com/RADStudio/en/Working_with_RTTI_Index">RTTI </a>to read and write component properties.  So no changes are needed to make a component&#8217;s properties linkable.</p>
<p>To make linking to commonly used properties easier, there is a registration method to indicate which member to show, by default, in the LiveBindings designer.   For example, RegisterValuePropertyName() is used to register "Text" as the default member of a FireMonkey TLabel and "Caption" as the default member of VCL TLabel.  See Fmx.Bind.Editors.pas and Vcl.Bind.Editors.pas.  RegisterValuePropertyName() is in Data.Bind.Components.</p>
<h3>LiveBindings-enable controls</h3>
<p>Controls must implement the ControlValue observer in order to support linking to component properties. My previous <a title="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653" href="http://blogs.embarcadero.com/jimtierney/2012/10/01/31653">post</a> has information about observers, including code for a sample control called TObservableTrackbar.    TObservableTrackBar implements the ControlValue observer, so supports links to component properties.  Here a TObservableTrackBar is linked to the "Width" property of a TShape.</p>
<p><a href="/files/2012/10/form1_6866.png"><img src="/files/2012/10/form1_6866.png" alt="" width="356" height="217" /></a></p>
<p class="akst_link"><a href="http://blogs.embarcadero.com/jimtierney/?p=31745&amp;akst_action=share-this"  title="Post to del.icio.us, etc." id="akst_link_31745" class="akst_share_link" rel="nofollow">Share This</a> | <a href="mailto:?subject=XE3%20Visual%20LiveBindings%3A%20Link%20controls%20to%20component%20properties&body=Have you seen this? http%3A%2F%2Fblogs.embarcadero.com%2Fjimtierney%2F2012%2F10%2F03%2F31745" id="akst_email_31745" class="akst_share_email" rel="nofollow">Email this page to a friend</a></p>]]></content:encoded>
			<wfw:commentRss>http://blogs.embarcadero.com/jimtierney/2012/10/03/31745/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
