These are chat archives for CRESS-Surrey/eXtraWidgets

29th
Apr 2015
Bryan Head
@qiemem
Apr 29 2015 03:33
@nicolaspayette So, I realized there was a problem with our plan.
However, I also realize that buttons don’t set the xw context.
and on-change is pretty much like a button being press, right? :D
Nicolas Payette
@nicolaspayette
Apr 29 2015 03:47
Aw, maybe you're right. Let me sleep on it... :-)
Bryan Head
@qiemem
Apr 29 2015 03:47
Alright, got another idea
I compile “task [ xw:ask <widget-key> [ run ? ] ]”, and then run that task with the users task as an argument on change
so this is kind of like the wrapping
I hadn’t though of doing it with an outer task before
Bryan Head
@qiemem
Apr 29 2015 16:34
@nicolaspayette I got it working with the task wrapping thing!
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:34
Woohoo!!! :-D
That's really really cool! Udating the PR soon?
Bryan Head
@qiemem
Apr 29 2015 16:35
question though: should I still pass in the value? The state of the widget can actually change multiple times before the listener is actually called, so the widget’s not guaranteed to have be in the same state as it was when the state change occurred
er does that make sense?
for instance:
    xw:on-selected?-change [
      print xw:selected?
    ]
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:36
Ah, yes, I understand.
Hum.
Bryan Head
@qiemem
Apr 29 2015 16:36
if you check and uncheck the checkbox super fast...
ya ok
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:36
Ya, tricky one.
Questions like that don't arise in regular Swing because everything runs on the event thread.
Bryan Head
@qiemem
Apr 29 2015 16:37
yup
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:37
But here, we're responding to GUI events on a separate thread...
Bryan Head
@qiemem
Apr 29 2015 16:37
I mean, there’s not really any reason not to pass in the value
the user can just ignore it if they want
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:37
Except that it could be confusing?
But when you click/unclick really fast, the task will be called twice, right?
Bryan Head
@qiemem
Apr 29 2015 16:40
It will be called twice
um
just a sec
sample output:
true
false
true
true
true
false
true
true
true
false
false
false
true
false
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:41
For the previous code snippet?
Bryan Head
@qiemem
Apr 29 2015 16:41
yup
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:42
And that's just repeated clicks? So it should be t f t f t f t f...
Bryan Head
@qiemem
Apr 29 2015 16:42
exactly
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:42
Which you would get by passing the value in the task.
I guess that's how it should be, then.
Bryan Head
@qiemem
Apr 29 2015 16:43
ok
Nicolas Payette
@nicolaspayette
Apr 29 2015 16:43
I'm just bothered by the fact that its possible that ? can differ from xw:selected?.
But I guess there is no way around it...
This will have to be explained carefully in the docs...