Cobry
Cobry

Reputation: 4548

wx.ListBox selection event

I am using wx.Python to develop a GUI under MacOS.

the widget making me crazy is a simple ListBox. here's the instance

self.values = wx.ListBox(self, wx.ID_ANY, style = wx.LB_MULTIPLE|wx.LB_NEEDED_SB)
self.Bind(wx.EVT_LISTBOX, self.on_add_selection_values, self.values)

the problem is that when I perform a multiple line selection (with a single click while holding the shift button) it generates multiple time EVT_LISTBOX.

an idea of how to resolve this issue?

regards

Upvotes: 1

Views: 1123

Answers (1)

ravenspoint
ravenspoint

Reputation: 20472

  Hover over first item
  Depress left mouse button
  Drag across all itemms
  Release mouse button

Is this how you are selecting the items? ( You mention MAC, which seems to have its own queer ideas about how to use a mouse )

If so, I suggest:

Ignore the wxEVT_COMMAND_LISTBOX_SELECTED event.
Handle the mouse button up event wxEVT_LEFT_UP by calling GetSelections()

Upvotes: 1

Related Questions