[Mono-list] Combo box focus problem

Manish Rai Jain manishrjain at gmail.com
Thu Jun 14 11:22:14 EDT 2007


I'm tracking down the "Changed" event of combo box, which notifies whenever
the user changes his selection. The idea is to only execute the code, if the
user clicks and selects from the box; and _not_ when the program itself does
the selection (like, combobox1.Active = 5).

The relevant section of the code is:

> combobox1.Changed += new EventHandler(OnPrivacyChanged);
> private void OnPrivacyChanged(object o, EventArgs args) {
>   if (!combobox1.IsFocus) return;
>
  // run code
>
  Console.WriteLine("change privacy only when user selects from the box");
> }
>

However, there's some problem with IsFocus, it always gives false,
irrespective of whether the user clicks on the box, or not. Because of that,
the code is never executed. Is there some way around it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070614/850a8766/attachment.html 


More information about the Mono-list mailing list