Jump to content

How to Trap Enter in DBGrid and Refresh


Recommended Posts

Hi,

 I need to trap Enter Key in UniDBGrid for Refreshing Calculate Field

when user press enter in cell editor, cursor will focus to the next column and calculate field value will be changed (refresh)

 

i use  

TForm........UniDBGrid.OnKeyDown

   if Key = VK_RETURN then <-- it doesn't work, cannot trap enter key

       RefreshDataset;

 

 

 

Thank you

 

Environment

Delphi XE7

UniGui 0.99.80.1214

Link to post
Share on other sites

I need to trap Enter Key in UniDBGrid for Refreshing Calculate Field

when user press enter in cell editor, cursor will focus to the next column and calculate field value will be changed (refresh)

 

i use  

TForm........UniDBGrid.OnKeyDown

   if Key = VK_RETURN then <-- it doesn't work, cannot trap enter key

       RefreshDataset;

 

Hi,

 

One of the possible solutions, may help, try

 

For now, you can use: UniDBGrid ... function edit(editor, context, eOpts)

 

1. UniDBGrid1 -> ClientEvents -> ExtEvents

function edit(editor, context, eOpts)
{
  function _post () {    
    ajaxRequest(editor.grid, '_post', []);
  }
  setTimeout(_post, 200);
}

2.

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if EventName = '_post' then
  begin
    if (UniDBGrid1.DataSource.DataSet.State in [dsEdit]) then
      UniDBGrid1.DataSource.DataSet.Post;
  end;
end;

Best regards.

Link to post
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...