Forum: wxRuby Wx::CheckListBox (maybe all ControlsWithItems?) oddities

2d352e436babbf3d80d4a6171220cd5b?d=identicon&s=25 Chloro Form (tony44)
on 2011-06-07 00:33
Hi,

OSX 10.6.7 w/ wxRuby 2.0.1 from rubyforge, reproducible on Windows 7.

I'm using a Wx::CheckListBox with

- LB_MULTIPLE
- LB_NEEDED_SB
- LB_SINGLE
- LB_SORT

I can reproduce the following behavior:

1.) Single selection doesn't work. No matter what I do, the CheckListBox
will always add to the selection, even when completely without an event
handler.

This is my remedy code:

  def on_select_list event
    index = event.get_index()
    @checklistbox.get_selections().each {|x| @checklistbox.deselect x }
    @checklistbox.select index
    # ... do stuff here
  end

2.) The sorting algorithm will sort the listbox strings but, while
auto-sorting after an append(string label, void clientdata), lose
association with the client (void) data.

Example scenario
1) CLB empty
2) append ("bbb", hash 2)
3) append ("aaa", hash 1)

after these three operations, the CLB always looks like

[0] string: "aaa" / data: hash 2
[1] string: "bbb" / data: hash 1

What am I doing wrong?

Thanks,
T
This topic is locked and can not be replied to.