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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...