sirinsidiator / ESO-LibAddonMenu

http://www.esoui.com/downloads/info7-LibAddonMenu.html
Artistic License 2.0
41 stars 20 forks source link

Adds multiselect.lua for multiple selection combo-boxes #122

Closed zoller27osu closed 2 years ago

zoller27osu commented 3 years ago

One feature still missing that might be nice is a quick way to select all options and a different quick way to deselect all options. Not entirely sure if that's already supported by the ZOS component.

Baertram commented 3 years ago

Deselect all items should be possible via ZO_MultiSelectComboBox:ClearAllSelections(), but there does not seem to be a way to multiselect items so far. Only ZO_MultiSelectComboBox:AddItemToSelected(item).

One could add something like function ZO_MultiSelectComboBox:AddItemsToSelected(items) for i, item in ipairs(items) do self:AddItemToSelected(item) end end

zoller27osu commented 3 years ago

Sorry if I wasn't clear, I fully know how to do it programming wise. I meant a UI way to trigger it. Cuz sure, you can add 2 half-width buttons to do it, but it would look nicer if the way was integrated into the multiselect somehow, whether by a key-combo or a certain type of click or tiny buttons in the selection text, etc.

Baertram commented 3 years ago

Oh yes, sorry I missunderstood it as well. Maybe a right click context menu via LibCustomMenu, only working if you right click at the "non expanded" (collapsed) combobox.

zoller27osu commented 3 years ago

Ah, smart! I shall see if a context menu on the "Selection Text" box is possible tomorrow.

zoller27osu commented 3 years ago

One feature still missing that might be nice is a quick way to select all options and a different quick way to deselect all options. Not entirely sure if that's already supported by the ZOS component.

All done! Component fairly extensively tested (at least, with dataType = "set").

sirinsidiator commented 3 years ago

I've just taken a look at the code and I'm wondering if there is a specific reason why this has to be a separate widget? From what I see it's pretty much a copy paste of the dropdown control with some extra code tacked on. I feel it would be better to simply add a new property "multiselect" to the existing control instead of splitting it into a new one. That way any fixes and adjustments to the dropdown won't have to be copied over to multiselect manually in the future. Also please use 4 space instead of a tab for indentation (see #13).

zoller27osu commented 3 years ago

There are major differences in the way that selection works/is reported. Also, the multiselects currently do not support scrolling as there is no corresponding component to ZO_ScrollableComboBox for multiselects.

I honestly think that attempting to add this functionality to combobox.lua would mainly result in a lot of confusing if-else's.

sirinsidiator commented 3 years ago

Fair point. Once you changed the whitespaces to meet the LAM coding conventions, I'll merge it in. Once it's merged, please add the new control to the wiki too.

zoller27osu commented 3 years ago

@sirinsidiator sorry for the delay, fixed it all up!

sirinsidiator commented 2 years ago

Hey. Sorry for the long silence. I'm going to close this pull request due to some changes in how I want to handle widgets in the future. The plan is that at some point all controls will be their own addon. For an example you can check out Baertram's Datepicker widget: https://www.esoui.com/downloads/info2932-LibAddonMenu-DatePickerwidget.html

That aside, I actually did try your branch and didn't manage to get the multiselect to show up. Are you sure it's actually working?

Baertram commented 2 years ago

As this has not been worked on for some months I've created the LAM widget base don the base dropdown box, inpired by the code of @zoller27osu . I hope this was okay. https://www.esoui.com/downloads/info3435-LibAddonMenu-MultiSelectdropdownwidget.html