ianharrigan / haxeui

IMPORTANT NOTE! This repository is no longer maintained. Please consider the newer version: https://github.com/haxeui/haxeui-core
http://haxeui.org/
392 stars 47 forks source link

Impossible to completely deselect OptionBoxes? #343

Open TheSHEEEP opened 8 years ago

TheSHEEEP commented 8 years ago

Assume a situation where three OptionBoxes belong to one group. Now, as the boxes are created, all of them are unselected.

But as soon as one of them was clicked, thus selected, it becomes impossible to deselect all of them. Even when manually setting box.selected = false for all boxes of a group, the last clicked one remains active.

Tested on Flash and Windows.

So far, I can only work around this issue by introducing an additional, invisible "none" Option that I select when I want the others to be deselected.

ianharrigan commented 8 years ago

Hi sorry for the late reply, been (am) snowed under with other work. Im not sure what the use case would be for this. I mean, arent optionboxes supposed to "lock you in" once you have selected an option? I cant think of an example where this isnt the case - this feature could be added of course, i just wonder what the use case is.

Another (probably ugly) option, is to style checkboxes like optionboxes and handle the selection yourself.

TheSHEEEP commented 8 years ago

The use case is that I have a list where you select elements. When an element is selected, its details are displayed in another part of the app. One of the details is such an option selection. By default, nothing is selected there. When you select a new item, the details part of the app is not completely scrapped and created anew - that would be a resource & performance waste. Instead, everything is reset to the default state and then the details of the newly selected item are applied - which may mean that nothing in the option selection is selected. Thus, it is possible that one selected option becomes no selected option.

I hope that made it somewhat clear ;)

ianharrigan commented 8 years ago

Not really... thats confused me more! :) - Its early though so coffee hasnt kicked in! ;)

A minimal sample of the use case would be good / interesting / useful if you have time to knock one up.

TheSHEEEP commented 8 years ago

Oops... sorry. Okay, have this screenshot: http://imgur.com/USKAnbS

In the top you see the list of elements, in the bottom the details of the currently selected element. The currently selected element has something selected in the options, but when switching to another element, it is possible that there is nothing selected for that element, thus no option must be selected when showing that other element.

ianharrigan commented 8 years ago

Isnt that a defined choice though? If im understanding you want to be able to unselect "I dont know yet", but isnt I dont know a valid choice? Why would you unselect it after selecting it?

ianharrigan commented 8 years ago

... ... or are you saying that you click "next" or something and it resuses the same UI but since its been selected it cant go back to unselected?

TheSHEEEP commented 8 years ago

Yes, the second one.

TheSHEEEP commented 8 years ago

That is what happens when you select a new item in the list.

ianharrigan commented 8 years ago

ah ha! I totally understand now then... So something like: "myOption.resetGroup" would make sense

TheSHEEEP commented 8 years ago

Yup, something like that. What I tried was setting "selected" of all boxes to false. Not sure if that could be made working as well: If you manually set "selected" of the currently selected box to false, no box will be selected.

ianharrigan commented 8 years ago

Right, ill take a look when i get a moment, the use case does totally make sense now to me.

TheSHEEEP commented 8 years ago

Do that, but don't get distracted from getting V2 out too much! A fully working HTML5 target is more important than this inconvenience ;)

ianharrigan commented 8 years ago

Agreed! A preliminary look at the code makes it look pretty straight forward to be honest. At the moment i dont even have time for v2 :o ... snowed under with "work work"... :)

3dformortals commented 6 years ago

still can see this insane behavior, for example in the haxeui demo screenshot win7 firefox

ianharrigan commented 6 years ago

Im away for xmas and nye - have you checked in an actual test project for this "insane" behaviour. Its likely the demo simply hasnt been updated to latest. If thats not the case this will, insanely, have to wait until after 2nd of jan (when i get back).

Cheers, Ian

ianharrigan commented 6 years ago

Just noticed this is haxeui version 1 also, not version 2 (https://github.com/haxeui/haxeui-core)

ianharrigan commented 6 years ago

Final follow up to this, it works when i compile component explorer from source (ie, not the version on the website). So this "insanity" is just because the component explorer is out of date on the website. Usually, its a better idea to try to reproduce bugs locally i find. :)

image