Jump to content


Photo

enter a cell in edit mode, like excel's F2 command?

excel edit mode

  • Please log in to reply
2 replies to this topic

#1 d6user

d6user
  • Members
  • 94 posts

Posted 21 September 2013 - 05:14 PM

solved -- see post 3 for answer.

hi, i'm not sure this has been asked, but. how does one set the cell into edit mode without having to double click the cell?

i want to similar excel's F2 command, where, when you are cursoring around the grid, and you press the F2 key, it puts you into edit mode.

i tried testing with nextgrid1.onclick(self) but that breaks me back into the IDE.

#2 d6user

d6user
  • Members
  • 94 posts

Posted 21 September 2013 - 08:19 PM

this code not working, although i've tried many different variation of code.

procedure TForm1.ng1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
  // insert row via INS key
  if key=VK_INSERT then InsRow1.Click;
  // capture F2 keypress
  if key=VK_F2 then ng1.OnCellClick(self,gl_gridcolno,gl_gridrowno);
end;

ng1 = nextgrid1
i am capturing the F2 keypress, see VK_F2.

or maybe simpler.., how do i call OnCellDblClick so that i can enter into Edit Mode?

writing: nextgrid1.OnCellDblClick(self) causes breaking out of the application.

#3 d6user

d6user
  • Members
  • 94 posts

Posted 21 September 2013 - 08:46 PM

solved -- it was nextgrid1.EditCell(col,row), will bring cell into edit mode.

procedure TForm1.ng1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
  // insert row via INS key
  if key=VK_INSERT then InsRow1.Click;
  // capture F2 keypress
  if key=VK_F2 then ng1.EditCell(gl_GridColNo,gl_GridRowNo);
end;

note, i am capturing the col/row in the .ng1SelectCell(Sender: TObject; ACol, ARow: Integer); routine.





Also tagged with one or more of these keywords: excel, edit mode

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users