thomthom / SKUI

Ruby wrapper of classes that maps to GUI controls in SketchUp's UI::WebDialogs
MIT License
26 stars 14 forks source link

Listbox size initialize #78

Open nicolasQbt opened 10 years ago

nicolasQbt commented 10 years ago

In listbox.rb line 36 in initialize

@properties[ :size ] = 1

should be :

@properties[ :size ] = list.length

If I create a list with 2 items, I have to set the size to 2 like this :

listbox.size = 2

otherwise I can't set the multiple= to true because :

if value && self.size < 2
    raise( ArgumentError,
         'Can only select multiple when size is greater than 1.' )
end
thomthom commented 10 years ago

That's intended, as when size is 1 the list is a dropdown list.

I guess that size might not be the best property to set it, but it directly links to the size property of SELECT elements in HTML. I'm not sure if the size attribute is really strictly enforced - as in, if you set the height then it will display as many items as possible.

So maybe there should be two classes here. One for dropdown lists and one for "normal" lists.

?

nicolasQbt commented 10 years ago

Maybe the two class is the good solution. For the moment, I force the size.