Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Grid: place editor in cell
Thu, Sep 25 2014 8:29 AMPermanent Link

Harry de Boer

Hi

How can I place a cursor in a cell of a grid to start editing that cell. The cell is representing a dataset's field. I have a button 'Edit' and onClick I want to place the cursor in a column (at the active record).

I did look into MoveTo, but cannot quite figure it out.

Regards, Harry
Thu, Sep 25 2014 8:58 AMPermanent Link

Matthew Jones

Harry de Boer wrote:

> Hi
>
> How can I place a cursor in a cell of a grid to start editing that
> cell. The cell is representing a dataset's field. I have a button
> 'Edit' and onClick I want to place the cursor in a column (at the
> active record).
>
> I did look into MoveTo, but cannot quite figure it out.


I'd be quite surprised if you could move the cursor (mouse pointer),
but what you need to do anyway is set the focus. You need something like

  editCell.SetFocus;

But not sure how that will work with a grid. You might have to set the
focus to the grid, or if you can see the editor, to that. The framework
source will have the details needed.


--

Matthew Jones
Thu, Sep 25 2014 5:42 PMPermanent Link

D.C.

Harry de Boer wrote:

Hi

How can I place a cursor in a cell of a grid to start editing that cell. The cell is representing a dataset's field. I have a button 'Edit' and onClick I want to place the cursor in a column (at the active record).

I did look into MoveTo, but cannot quite figure it out.

Regards, Harry

Hi Harry,
This work for me. A Grid with one row an 2 columns, on the button click:

  Grid1.SetFocus;
  Grid1.MoveTo(1,0);
  Grid1.ToggleEditor;

The cursor was placed on second column first row and the cursor started to blink.

Regards
Diego
Fri, Sep 26 2014 1:15 AMPermanent Link

Harry de Boer

D.C. wrote:

  Grid1.SetFocus;
  Grid1.MoveTo(1,0);
  Grid1.ToggleEditor;

Hi Diego

Thanks, How do you determine on which row a current data record is?

Regards, Harry
Fri, Sep 26 2014 7:30 AMPermanent Link

D.C.

Hi Harry,
Check this:

  Grid1.SetFocus;
  Grid1.MoveTo(1,Grid1.RowIndex);
  Grid1.ToggleEditor;

Regards
Diego
Fri, Sep 26 2014 9:03 AMPermanent Link

Harry de Boer

D.C. wrote:

Hi Harry,
Check this:

  Grid1.SetFocus;
  Grid1.MoveTo(1,Grid1.RowIndex);
  Grid1.ToggleEditor;

Regards
Diego

Thanks Diego, works fine!
Regards, Harry
Image