Skip to content

Commit

Permalink
fix WXOSX ListBox peculiarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorino committed Nov 19, 2023
1 parent 06a9603 commit 8f1a731
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/wx/core/generic_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,15 @@ def get_handler

GenericValidator.define_handler(Wx::ListBox) do |win, *val|
if val.empty?
if (win.get_window_style & Wx::LB_SINGLE) == Wx::LB_SINGLE
# test this the hard since on WXOSX LB_SINGLE is default but does get set
# by default i.e. on WXOSX no selection type bit set == LB_SINGLE
if (win.get_window_style & (Wx::LB_MULTIPLE|Wx::LB_EXTENDED)) == 0
win.get_selection
else
win.get_selections
end
else
if (win.get_window_style & Wx::LB_SINGLE) == Wx::LB_SINGLE
if (win.get_window_style & (Wx::LB_MULTIPLE|Wx::LB_EXTENDED)) == 0
win.set_selection(val.shift)
else
win.get_count.times { |i| win.deselect(i) }
Expand Down

0 comments on commit 8f1a731

Please sign in to comment.