I have a form (Fire Monkey) with multiple frames on it. I would like to execute some common code (same code for all frames) when the focus enters a frame and exists a frame. Can anyone assist with some example please? I tried setting the OnEnter and OnExit in the Frame definition and also on the Frame instances, but none worked. If I set it on a control on the Frame it works, but I need to know when a frame becomes focused, irrespective of the controls on it.

I have a form (Fire Monkey) with multiple frames on it. I would like to execute some common code (same code for all frames) when the focus enters a frame and exists a frame. Can anyone assist with some example please? I tried setting the OnEnter and OnExit in the Frame definition and also on the Frame instances, but none worked. If I set it on a control on the Frame it works, but I need to know when a frame becomes focused, irrespective of the controls on it.
In short, using this, I want to know where in my form the focus is at any point in time.
I need to load the frames at runtime, so I will need to link the events also at runtime I think.

Comments

  1. Hi Andrea,

    Yes, you are correct. I have in the meantime asked the question on Stackoverflow as well and got an excellent answer from Tom Brunberg. He suggested the same solution that you do.

    You can see the question and his answer here.

    stackoverflow.com - Delphi Firemonkey Frames - How to get the event OnEnter and OnExit of the usage of a frame

    ReplyDelete
  2. Great to know you already solved with Tom and Dave (I prefer Dave's approach as I wrote). Have a nice day ;-)

    ReplyDelete
  3. Yes, sorry, I preferred Dave's solution as well. It makes for easier maintenance as well.

    ReplyDelete

Post a Comment