Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #120, on January 18th, 2012, 05:22 PM »
Reading, yes, following... that's another question entirely. I hate to say it but a lot of this lately has just gone over my head :(
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #121, on January 18th, 2012, 05:56 PM »
You mean you've lost interest, or you think you've lost the required skill? :-/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #122, on January 18th, 2012, 06:20 PM »
Mostly the latter :(

It's simply that there's so much stuff to it I don't think I can grasp all that's required to make it work properly or all the consequences of the changes that are being discussed.

I much prefer simpler stuff like DB optimisation and plugin management...

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #123, on January 18th, 2012, 07:17 PM »
Then focus on that (and on trying to establish a realistic to-do list with me ;))

My forte is front-end programming, and what have I been working on..? Front-end!
We're not paid, there's no reason we should in addition work permanently on shit we don't want to touch :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #124, on February 13th, 2012, 12:18 PM »
In other news I have incidentally found functionality that is broken by this feature, but that probably needed rewriting anyway.

The admin pages that use prepareDBSettingContext theoretically support select with multiple items (i.e. that ghastly situation where you have to ctrl-click to select items from a listbox), but the new selectbox doesn't support this.

Not a real problem, since select-multiple is not actually used anywhere in Wedge (nor, I think, in SMF but included out of thoroughness) so what I'll do is remove multiple support, and replace it with a new type for multi-selections.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #125, on February 13th, 2012, 01:14 PM »
Well -- technically, what you wanna do is use <select size="something"> instead of just a select. Set something to > 0 and you'll get the multi-select feature.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #126, on February 13th, 2012, 01:16 PM »
Wish I'd have known that earlier >_< That'll teach me not to remember every nuance of the code :P

Since the JS selectbox is much better than what I was working, I'll run with that instead.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #127, on February 13th, 2012, 01:19 PM »
You can always remove stuff you don't like, you know... I won't blame you for that ;)
I'm just saying that Sbox doesn't support non-dropdown select boxes, so it leaves it to the regular GDI drawing, and thus gets to benefit from its features.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #128, on February 13th, 2012, 01:22 PM »
Oh... I thought it did something neat, and it seems my revert was a little too hasty. Oh well >_<

(I'm really not a fan of the classic Ctrl-click selector, I find it very irritating to use.)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #129, on February 13th, 2012, 01:51 PM »
Very sorry about the misunderstanding.
I could implement it, still. But I figured it'd add at least 300-500 bytes and for just a few underused places, avatar selection being the most prominent...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #130, on February 13th, 2012, 01:53 PM »
Eh, don't worry about it, more my fault for not double checking, and as it happens, I've already reimplemented my code.

In my case it's not the avatar selection I have in mind, but doing something with the notify-on-registration lark. Specifically, I wanted to have it so that you could select users who would be notified on a new registration rather than 'everyone who can approve registrations', but I can make use of it in other places, too.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #131, on February 13th, 2012, 06:23 PM »
Your multi-select thing -- is this what you're using in Notify Admins? Didn't have time to check the code... What did you replace the select box with?

Re: on-topic, I'm currently doing tests with a dropdown positioned absolutely relative to the body, rather than the select box itself... This seems to fix all problems met in Opera, but OTOH it also means that if the element is moved, the dropdown won't move along with it...
Fun times :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Selectbox
« Reply #132, on February 13th, 2012, 09:23 PM »
It's a new field type called multi_select, which works like a select in receiving parameters and just displays it much as the inline_permissions does with a select box.

The values are serialized when saved (just as the old select multiple code)
Re: Selectbox
« Reply #133, on February 14th, 2012, 10:25 PM »
OK, so I've been using the selectbox and I'm fairly sure I'm not doing it right, but I'd love some insight into this.

So, I have a selectbox that does something in its onchange event; it's set inline but the event delayer deals with it just fine, so all good up to that point.

The issue comes in when other stuff happens and I need to reset the selectbox (or otherwise force it to a certain value programmatically). There's only one way I can see of doing that and that's to use jQuery to select the original selectbox itself, .val(...) with the new value, then .sb() it to reload it, but I'm sure there must be a better way of doing it than that.

Setting selectboxes programmatically isn't going to come up often but it would be nice to know the best way to deal with it if it is going to happen - the code doesn't seem to have any kind of direct-set value function, and I'm loathe to add one manually because it's very complex code and I don't want to break it accidentally (or make it bigger)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Selectbox
« Reply #134, on February 14th, 2012, 11:25 PM »
There's no 'better' way than doing .sb() in the method chain after loading the value.
And yes, it 'looks ugly', but the alternatives were:
- adding a timer to determine whether the select box had changed (slow, resource intensive, silly)
- overloading the various jQuery functions that change attributes and stuff, to determine whether it belongs to a select box and thus trigger a timeout to redraw. Very slow, slightly resource intensive, complicated.

Please don't touch sbox.js itself, as you feared it's very, very prone to accidents :P (I broke it dozens of times, and I'm the one who wrote it!)