I'm still strugling with the switch from the TMSFMXLivegrid to the TMSFNCGrid.
I created a little demo that show where I'm running into:
type
TForm13 = class(TForm)
TMSFNCGrid1 : TTMSFNCGrid;
Panel1 : TPanel;
Edit1 : TEdit;
Edit2 : TEdit;
BindNavigator1 : TBindNavigator;
VirtualTable1 : TVirtualTable;
DataSource1 : TDataSource;
TMSFNCGridDatabaseAdapter1 : TTMSFNCGridDatabaseAdapter;
BindSourceDB1 : TBindSourceDB;
procedure FormCreate(Sender: TObject);
procedure BindNavigator1Click(Sender: TObject; Button: TNavigateButton);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form13: TForm13;
implementation
{$R *.fmx}
procedure TForm13.BindNavigator1Click(Sender: TObject; Button: TNavigateButton);
begin
case Button of
nbFirst,
nbPrior,
nbNext,
nbLast:
begin
With TMSFNCGrid1 do
begin
Edit1.Text:= GetCellObject(MakeCell(0,SelectedRow[0])).Text;
Edit2.Text:= GetCellObject(MakeCell(1,SelectedRow[0])).Text;
end;
end;
end;
end;
procedure TForm13.FormCreate(Sender: TObject);
Var
i: Integer;
begin
VirtualTable1.Clear;
VirtualTable1.Close;
VirtualTable1.FieldDefs.Clear;
with VirtualTable1.FieldDefs.AddFieldDef do
begin
DataType:= ftInteger;
Name := 'id';
end;
with VirtualTable1.FieldDefs.AddFieldDef do
begin
DataType:= ftInteger;
Name := 'nr';
end;
VirtualTable1.IndexFieldNames:= ('id ASC');
VirtualTable1.Open;
for i := 1 to 500 do
begin
VirtualTable1.InsertRecord([Random(i100),Random(i1000)]);
end;
VirtualTable1.First;
DataSource1.DataSet := VirtualTable1;
BindSourceDB1.DataSource := DataSource1;
BindNavigator1.DataSource := BindSourceDB1;
TMSFNCGridDataBaseAdapter1.DataSource := DataSource1;
TMSFNCGridDataBaseAdapter1.Grid := TMSFNCGrid1;
TMSFNCGridDataBaseAdapter1.Active := True;
TMSFNCGrid1.Options.Selection.mode := smDisjunctRow;
TMSFNCGrid1.Options.Editing.Enabled := False;
TMSFNCGridDataBaseAdapter1.LoadAllDataAndDisconnect;
TMSFNCGridDataBaseAdapter1.Active := True;
end;
What am I doing wrong and how can I do that the right way.
TIA Anske