* * *

Author Topic: OnEnter not firing on button press  (Read 611 times)

ranlaborde

  • New member
  • *
  • Posts: 11
OnEnter not firing on button press
« on: August 11, 2017, 12:23:21 pm »
I am having difficulty with the OnEnter event not executing when a button is clicked.  It fires when run on Windows but but not on Mac.  I am using the OnEnter to validate entered data prior to proceeding to the next step in my application.  I have Sierra 10.12.6.  I am using Lazarus 1.6.4.  Why is the behavior different?  Is there a fix or a work around?  I am attaching a sample file. Thanks 

ChrisR

  • New member
  • *
  • Posts: 35
Re: OnEnter not firing on button press
« Reply #1 on: August 13, 2017, 07:13:06 am »
Nice example of the problem. I suggest filing two bug reports on [https://mantis.freepascal.org/my_view_page.php]. File one bug report for the Carbon LCL and one for the Cocoa LCL, as the problem exists with both.

Thaddy

  • Hero Member
  • *****
  • Posts: 4774
Re: OnEnter not firing on button press
« Reply #2 on: August 13, 2017, 08:27:22 am »
I wonder if it is supported...with the mouse driver in OSX. What happens when you select a button with the tab key and press enter?
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

carl_caulkett

  • Full Member
  • ***
  • Posts: 243
Re: OnEnter not firing on button press
« Reply #3 on: August 13, 2017, 09:41:56 am »
I'm testing this on Lazarus 1.8.0RC3 on the Apple Mac with the Carbon widget set.

As soon as the app starts, if I press the tab key just the once, I see the list box receive focus, and I see messages saying First Button Enter AND Second Button Enter.

I don't know what this means, having just this minute woken up, but someone more skilled than I will hopefully understand what on earth is going on!
macOS 10.12.6
Lazarus 1.8.0 RC4
FPC 3.0.2

ranlaborde

  • New member
  • *
  • Posts: 11
Re: OnEnter not firing on button press
« Reply #4 on: August 13, 2017, 12:01:54 pm »
What is going on is that the Listbox displays the order of events that occur under different situations, such as tabbing or clicking.  What occurs is that on the Mac the events OnEnter and OnExit are bypassed.  This, I have figured out, is because the focus does not change (unlike in Windows) when controls such as buttons are clicked. 

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus