Delphi livebinding TClientDataSet TStringGrid runtime

in Firemonkey (XE5) I created a Frame with a TStringGrid and want to add a "procedure ShowData( aClientSet:TClientSet);" in that pprocedure the rows of the Clientset shall be shown readonly with LiveBindings (TBindSourceDB ?) without knowing anything else of the dataset and WITHOUT DESIGNER ? Please, how can this be done in runtime ? And how to control that the Grid be refilled, if the Dataset closed and reopened outside the Frame (where to fire TBindings.notify) ? Thx.

Answers


The following worked for me:

  1. Include Data.Bind.EngExt, Fmx.Bind.DBEngExt, Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components, Data.Bind.Grid and Data.Bind.DBScope in your uses clause.
  2. Assuming your TStringGrid is named grid1 and your dataset is called qry1 :

    var   bds: TBindSourceDB;   bdl: TBindingsList;   gtd: TLinkGridToDataSource; begin   bds := TBindSourceDB.Create(Self);   bdl := TBindingsList.Create(Self);   gtd := TLinkGridToDataSource.Create(bdl);

      gtd.DataSource := bds;   gtd.GridControl := Grid1;

      bds.DataSet := qry1; end;

Hope this helps! (I used a TFDQuery as my dataset, but I'm sure any TDataset descendant should work fine.)


Need Your Help

Apache Kerberos not Authenticating from Windows Client

apache authentication kerberos

With a number of great websites for reference, I setup an Apache 2.4 environment on Solaris 11 using the auth_gss_module for Kerberos authentication. The problem I have is not being able to access...

Disabling the note and shipping address in paypal checkout

php paypal

How to disable shipping address and note in paypal checkout using PAYPAL api?