Topic: TableGrid Selected Row

Hi to all,
when a form shows up how can a TableGrid be set up on the firt record.
I use the following script

Form1.TableGrid1.SelectedRow:=0;
Form1.TableGrid1.SetFocus;

Re: TableGrid Selected Row

v_pozidis wrote:

Hi to all,
when a form shows up how can a TableGrid be set up on the firt record.
I use the following script

Form1.TableGrid1.SelectedRow:=0;
Form1.TableGrid1.SetFocus;

Hello,

This script should work, if you place it in the event OnShow.

Dmitry.

3 (edited by v_pozidis 2016-04-25 09:32:07)

Re: TableGrid Selected Row

I send you my example


I When i save the WorkPhone it doesn't show the record in the Tablegrid.
Only when I press the Tablegrid of the home details it shows the phone.

How can i solve it?

Post's attachments

Attachment icon HelpWithTable.zip 326.96 kb, 457 downloads since 2016-04-25 

Re: TableGrid Selected Row

Please try this script:

procedure frmCreateHome_Button7_OnAfterClick (Sender: string);
begin
    frmCreateHome.Button5.Click;
end;
Dmitry.

Re: TableGrid Selected Row

I have tried it but nothing.

Re: TableGrid Selected Row

v_pozidis wrote:

I have tried it but nothing.

I made some changes in your project.

Post's attachments

Attachment icon HelpWithTable_fixed.zip 8.25 kb, 492 downloads since 2016-04-25 

Dmitry.

Re: TableGrid Selected Row

Yes it works, Thank's

But when I select to create a New Record from the Form1 the tablegrig3 for the phones of work is full from other numbers. How can
the Tablegrid be clean until a new record is added?  I tried the TableGrid.ClearRows but it didi't anything.

Re: TableGrid Selected Row

v_pozidis wrote:

Yes it works, Thank's

But when I select to create a New Record from the Form1 the tablegrig3 for the phones of work is full from other numbers. How can
the Tablegrid be clean until a new record is added?  I tried the TableGrid.ClearRows but it didi't anything.

You should change this event like this:

procedure frmCreateHome_OnShow (Sender: string; Action: string);
begin
    if Action = 'ShowRecord' then
    begin
        frmCreateHome.TableGrid2.SelectedRow:=0;
        frmCreateHome.TableGrid2.SetFocus;
        frmCreateHome.Button5.Click;
    end else frmCreateHome.TableGrid2.ClearRows;
end;
Dmitry.

Re: TableGrid Selected Row

yes  know its working. Thak's so much Dmitry