Topic: Set Focus

Hi Guys,


I wanted to set auto focus on tgrid 1st record row rather than clicking on the record with:

procedure Form1_tgCustomersSearch_OnChange (Sender: string);
begin
Form1.tgCustomersSearch.SetFocus;
end;

but didn't work. What would be the correct script please?

Adam
God... please help me become the person my dog thinks I am.

Re: Set Focus

Hello Adam,


If you want to select a chosen row in a TableGrid, I think you should try :

procedure Form1_tgCustomersSearch_OnChange (Sender: string);
begin
     Form1.NameOfYourTableGrid.SelectedRow := NumberOfTheRowYouWantSelected;
end;

I think if you want the first row to be selected, selected row will be number 0


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Set Focus

procedure Form1_TableGrid2_OnChange (Sender: string);
begin
    if Form1.TableGrid2.RowCount > 0 then
    begin
        Form1.TableGrid2.SelectedRow := 0;
        Form1.TableGrid2.ScrollToRow(0);
    end;
end;
Dmitry.