Quantcast
Viewing all articles
Browse latest Browse all 5791

How to add MouseWheel event to Eto control

@Terry_Chappell wrote:

@dale,

I have a simple Eto form that we have been using to learn about Eto Forms. I want to add a MouseWheel event to a ComboBox control which enabling scrolling of the SelectedIndex for this control. To do this I added MouseWheel = self.OnMouseWheel to the control and included an event handler:

	def OnMouseWheel(self, sender, e):
		i = 1 if e.Delta > 0 else -1
		next = min(2, max(0, self.n_combobox.SelectedIndex + i))
		self.n_combobox.SelectedIndex = next

This works with .NET forms. The problem with the Eto Form is that the Python compiler complains:

Message: ComboBox() takes no arguments (5 given)

since it does not recognize MouseWheel as a legitimate argument for the control.

What is the proper way to add a MouseWheel event to the control on this Eto Form?

The complete form is here:

ETO Example Revised.py (7.9 KB)

Regards,
Terry.

Posts: 9

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5791

Trending Articles