Jump to content

Change the key Enter for edit cell in unidbgrid


taha_gh

Recommended Posts

Hi Taha

 

Try:

 
  This code not cancels pressing Enter 
  Simply adds the F2 key to enter the cell

 

procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var gridJSName: string;
begin
  if Key = VK_F2 then begin
    gridJSName := (Sender as TUniDBGrid).JSName;    
    UniSession.AddJS(gridJSName + '.editingPlugin.startEditByPosition({row: ' + gridJSName + '.uniRow, column: ' + gridJSName + '.uniCol})');
  end;
end;

Best regards.

Link to comment
Share on other sites

This code cancels pressing Enter, but it is not the best way ...:

 

UniDBGrid1 -> ClientEvents -> ExtEvents -> add and replace function keydown:

function keydown(e)
{
  if (e.keyCode == 13 && this.editingPlugin) {    
    this.editingPlugin.completeEdit(); 
  }
}
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...