Jump to content

How to Setfocus in a specified Column/Cell in a grid?


CiceroBillo

Recommended Posts

Hi!

 

I'm inserting new record in a Grid and I'd like to have cursor at first column, but cursor is positioned in the second column.

 

The first column was defined a ReadOnly, but when Dataset is in Insert state I change the property ReadOnly to False, but this don't change the cursor position.

 

How can I do That, please?

Link to comment
Share on other sites

26 minutes ago, CiceroBillo said:

The first column was defined a ReadOnly, but when Dataset is in Insert state I change the property ReadOnly to False, but this don't change the cursor position.

Hello,

Do you have a simple testcase to check your case?

Link to comment
Share on other sites

10 minutes ago, Sherzod said:

Hello,

Do you have a simple testcase to check your case?

You don't need a testcase. Just use your own grid demo and when you are inserting a record just setfocus randomly to any column as an example, please.

 

Just for show how to focus any column/cell when you need it.

 

Thank's.

 

 

Link to comment
Share on other sites

4 minutes ago, CiceroBillo said:

You don't need a testcase.

You or I will do this, but we still need a test case.

48 minutes ago, CiceroBillo said:

The first column was defined a ReadOnly

Okay.

48 minutes ago, CiceroBillo said:

but when Dataset is in Insert state I change the property ReadOnly to False, but this don't change the cursor position.

Please provide code how you do it.

Link to comment
Share on other sites

1 hour ago, Sherzod said:

You or I will do this, but we still need a test case.

Okay.

Please provide code how you do it.

procedure TfrmCadHISTORICO_ITENS.QryHistorico_DisciplinaBeforeInsert(  DataSet: TDataSet);
begin
  inherited;
  grdHistorico_Disciplina.ColumnByName('NomeDisciplina').ReadOnly := False;
  grdHistorico_Disciplina.ColumnByName('NomeDisciplina').Locked := False;
end;

 

On AfterPost I change to both properties to True.

 

This working now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...