Bug 22045 - The event for change on a combobox does not trigger.
Summary: The event for change on a combobox does not trigger.
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: 2.0.x
Assignee: Chris Hamons
Depends on:
Reported: 2014-08-12 14:31 UTC by Steven Adams
Modified: 2015-03-02 09:19 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Steven Adams 2014-08-12 14:31:12 UTC
I attempted to hook a changed event to my combo box however it never fires. Refer to forum post for source details. http://forums.xamarin.com/discussion/18933/nscombobox-changed-not-triggering
Comment 1 Prashant manu 2014-08-21 10:56:23 UTC
Could you please provide us the test steps you followed. If possible please
attach a small complete project that demonstrates this behavior.

Also can you please add the logs from the following places?:
On XS IDE Log  Location: XS>Help> Open Log Directory> IDE.log file (with latest
Comment 2 Chris Hamons 2014-12-03 18:04:31 UTC
There appears to be something strange going on:

			NSComboBox b = new NSComboBox (new RectangleF (0, 0, 200, 25));
			b.Add ((NSString)"1");
			b.Add ((NSString)"2");
			b.Add ((NSString)"3");
			b.SelectionChanged += (sender, e) => Console.WriteLine ("ho");

			b.Changed += (sender, e) => Console.WriteLine ("Hey");
			mainWindowController.Window.ContentView.AddSubview (b);

If you do this you'll get Hey when you type but not select from the list. Invert the 2 changed events and you'll get notification when you click but not type...
Comment 3 Chris Hamons 2014-12-08 13:47:16 UTC
So far matching obj-c: https://gist.github.com/chamons/5e5045841aee826b396e

We're only getting del calls when you pick from list, not typing in.
Comment 4 Chris Hamons 2014-12-15 10:18:42 UTC
Here's the deal.

In objective-c, you need to listen to two selectors to sort out this case, one for clicking on elements and one for hitting enter. This is the equivalent c# code.

			NSComboBox b = new NSComboBox (new CGRect (0, 0, 200, 25));

			b.SelectionChanged += (sender, e) => Console.WriteLine ("Change");
			b.EditingEnded += (sender, e) => Console.WriteLine ("Edit");

This should work, but doesn't due to a longstanding issue with our generated c# event support.

I have a patch worked up to fix this, but it won't make 1.12 for sure.

To work around this, you can implement the NSComboBoxDelegate and use that instead of the c# events.
Comment 5 Chris Hamons 2015-02-18 12:24:20 UTC
Fixed in 2491f2f734e3052aabbfa9ac76c60ec8e23d7748 on master.
Comment 6 Chris Hamons 2015-02-18 12:38:02 UTC
Oh, and this is only fixed for the Unified Xamarin.Mac APi. The change was invasive / possibly breaking enough that we are making zero changes for Classic.
Comment 7 Rajneesh Kumar 2015-03-02 09:19:52 UTC
I have checked this issue with the following builds:

=== Xamarin Studio ===
Version 5.8 (build 1033)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Mono 4.0.0 ((detached/2634099)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400000017
Apple Developer Tools Xcode 6.1.1 (6611)
Build 6A2008a
 Xamarin.Mac Version: (Business Edition)
 === Build Information ===
Release ID: 508001033
Git revision: e8120ebd0c9ee45a83e48ae431e65797c172403f
Build date: 2015-02-26 13:09:22-05
Xamarin addins: e88a2212bb7156a42ad6728b82e99846c3eea817
Operating System Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
Tue Jun  3 21:27:35 PDT 2014
root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

I observed that this issue is working fine. Now, the event for change on a combobox getting called , when I type something on combobox. So now we are getting del calls when you pick from list, also typing in combobox. 
Screencast: http://www.screencast.com/t/QEqv020X3jP

This issue has been fixed, hence I am closing this issue.