Recent

Author Topic: SOLVED: Detecting clicks in all others controls  (Read 686 times)

SaraT

  • Full Member
  • ***
  • Posts: 124
  • A little student
SOLVED: Detecting clicks in all others controls
« on: February 21, 2020, 09:23:16 pm »
Hi there
Lets say that I have a control Edit1.
How can I detect if I did click in any other control, different control to Edit1?
or maybe detect clicks outside of Edit1 control.


Yes, without using OnEnter, OnExit events of the Edit1.
Many and many thanks again for your time :)
« Last Edit: February 21, 2020, 11:35:49 pm by SaraT »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Detecting clicks in all others controls
« Reply #1 on: February 21, 2020, 09:49:55 pm »
Hi !

Connect the onClick event of all visible component of form1 - including form1 - with this procedure:

Code: Pascal  [Select][+][-]
  1. Procedure TForm1.allClick(Sender: TObject);
  2. begin
  3. if sender is Edit1 then showMessage ('Bingo')  else
  4.     showmessagae ('Clicked on '+TComponent(sender).name);
  5. end;

Winni

SaraT

  • Full Member
  • ***
  • Posts: 124
  • A little student
Re: Detecting clicks in all others controls
« Reply #2 on: February 21, 2020, 11:35:12 pm »
Hi !

Connect the onClick event of all visible component of form1 - including form1 - with this procedure:

Code: Pascal  [Select][+][-]
  1. Procedure TForm1.allClick(Sender: TObject);
  2. begin
  3. if sender is Edit1 then showMessage ('Bingo')  else
  4.     showmessagae ('Clicked on '+TComponent(sender).name);
  5. end;

Winni

Thanks Winni. Works perfect.

 

TinyPortal © 2005-2018