Jump to content

Tdbgrid onenter/onexit events


Roberto Nicchi

Recommended Posts

1 hour ago, Sherzod said:

Hello,

What do you implying about these events?

I would like to execute some Delphi code when the focus enter the grid and when exit. In detail the code active (entering) and deactivate (exiting) some components ...

The events are present in the Tunidbgrid class but are not executed. I remeber there was some problem in unigui (probably related to the Sencha framework ?) and so was impossible to detect the focus entering/exiting the grid.

Maybe the grid enhancements have/will remove this problem.

thanks

Link to comment
Share on other sites

17 hours ago, Roberto Nicchi said:

I would like to execute some Delphi code when the focus enter the grid and when exit. In detail the code active (entering) and deactivate (exiting) some components

Hello,

Try this approach for now.

1. 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1.JSInterface do
  begin
    JSAddListener('focusenter', 'function(me){ajaxRequest(me, "focusenter", [])}');
    JSAddListener('focusleave', 'function(me){ajaxRequest(me, "focusleave", [])}');
  end;
end;

2. 

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'focusenter' then
  begin
    //
  end
  else if EventName = 'focusleave' then
  begin
    //
  end;

end;

We will try to add this in the next builds.

Link to comment
Share on other sites

5 hours ago, Sherzod said:

Hello,

Try this approach for now.

1. 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1.JSInterface do
  begin
    JSAddListener('focusenter', 'function(me){ajaxRequest(me, "focusenter", [])}');
    JSAddListener('focusleave', 'function(me){ajaxRequest(me, "focusleave", [])}');
  end;
end;

2. 

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'focusenter' then
  begin
    //
  end
  else if EventName = 'focusleave' then
  begin
    //
  end;

end;

We will try to add this in the next builds.

Thanks a lot. I'll try it.

Link to comment
Share on other sites

5 hours ago, Roberto Nicchi said:

Thanks a lot. I'll try it.

I have just tryed and it seems to work fine. Thanks a lot.

Another thing that would be usefull (anyway i don't need it immediately) are two grid events that allows to detect when the focus exit (oncolumnexit) or enter (oncolumnenter) a grid column.

Thanks

Link to comment
Share on other sites

19 minutes ago, Sherzod said:

Can you please clarify? 

OK, consider a grid with some columns. When the focused cell is in a specific column we want to activate a button in a tool bar that allows to perform some task. For example open a list where is possible to select some value for the cell. In the oncolumnenter event we could check if the focused cell is in that column and, if so, setup the tool button (enable it, maybe change the button icon, and set the onclick event with a specific procedure). In the oncolumnexit we will disable the button.

thanks.

Link to comment
Share on other sites

13 minutes ago, Roberto Nicchi said:

OK, consider a grid with some columns. When the focused cell is in a specific column we want to activate a button in a tool bar that allows to perform some task. For example open a list where is possible to select some value for the cell. In the oncolumnenter event we could check if the focused cell is in that column and, if so, setup the tool button (enable it, maybe change the button icon, and set the onclick event with a specific procedure). In the oncolumnexit we will disable the button.

thanks.

procedure TMainForm.UniDBGrid1SelectionChange(Sender: TObject);
begin
  ShowMessage((Sender as TUniDBGrid).CurrCol.ToString)
end;

?

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...