Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: ranlaborde on August 11, 2017, 12:23:21 pm

Title: OnEnter not firing on button press
Post by: ranlaborde 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 
Title: Re: OnEnter not firing on button press
Post by: ChrisR 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.
Title: Re: OnEnter not firing on button press
Post by: Thaddy 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?
Title: Re: OnEnter not firing on button press
Post by: carl_caulkett 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!
Title: Re: OnEnter not firing on button press
Post by: ranlaborde 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. 
TinyPortal © 2005-2018