12-09-2019, 09:19 AM
Hi Guys,
As there have been no replies to this question, I take it it is either a very trivial question, which everybody with just the slightest Delphi knowledge should know about and therefore no one feel its necessary to comment or propose solutions, or it is a very complicated issue, possibly impossible, or at least something no one else seem to need (or know about) a solution to.
Well, because I use javascript to activate the OnClick event of a button when hitting a certain key on the keyboard, I need it and now I've found an alternative, at least to the part of knowing which control is the active one, when the OnClick event is fired:
I've created a global (on form level) variable called ActCon.
I've assigned a unique value to the tag property of the edit controls I want to check, and to the tag property of the button.
I've created ONE common OnEnter event for all the Edit controls, and the button, in which I assign the tag value of the "sender" to the global var ActCon.
In the OnClick event of the button, I check the value of ActCon and then know which control has focus when the OnClick event i fired, and can take appropriate action.
NB! I'll be happy to make a small test program if anybody will want an actual example.
Regards
Soren
As there have been no replies to this question, I take it it is either a very trivial question, which everybody with just the slightest Delphi knowledge should know about and therefore no one feel its necessary to comment or propose solutions, or it is a very complicated issue, possibly impossible, or at least something no one else seem to need (or know about) a solution to.
Well, because I use javascript to activate the OnClick event of a button when hitting a certain key on the keyboard, I need it and now I've found an alternative, at least to the part of knowing which control is the active one, when the OnClick event is fired:
I've created a global (on form level) variable called ActCon.
I've assigned a unique value to the tag property of the edit controls I want to check, and to the tag property of the button.
I've created ONE common OnEnter event for all the Edit controls, and the button, in which I assign the tag value of the "sender" to the global var ActCon.
In the OnClick event of the button, I check the value of ActCon and then know which control has focus when the OnClick event i fired, and can take appropriate action.
NB! I'll be happy to make a small test program if anybody will want an actual example.
Regards
Soren

