Text edit %focused always reports true

23 views
Skip to first unread message

Neil Bird

unread,
Aug 17, 2016, 4:20:18 AM8/17/16
to Tasker
In trying to set a separate background colour of the currently focussed text edit widget, I've found that the %focused variable in the event is always true (both when gaining and losing focus), leading each widget in turn to think it's the one with focus until they all do.

Someone else seems to be reporting this on grokbase as well, with no response.  Is this a legitimate (common) bug or localised to our set-up/devices?

Pent

unread,
Aug 25, 2016, 5:31:44 AM8/25/16
to Tasker
I can reproduce that and will try and think of a way to fix it (it's a difficult timing
issue)

Pent

Neil Bird

unread,
Aug 25, 2016, 5:33:54 AM8/25/16
to tas...@googlegroups.com
Cheers.

Weird timing bugs are the worst...
--
Boring .signature #1,423

Pent

unread,
Aug 25, 2016, 5:51:38 AM8/25/16
to Tasker
Looking further at this, turns out it applies to all built-in scene variables
(e.g. element name) when scene tasks are running simultaneously,
because all tasks launched from a scene share the same set of variables
which dynamically update.

So while the 'lost focus task' is just starting running, the 'gained focus' task starts
and sets the scene-shared %focused variable to true, a change which is
also seen by the 'lost focus task'.

I'm amazed this problem hasn't come up before...

Needs a bit of thought. Possibly I could make the built-in scene vars non-shared.

Pent

Neil Bird

unread,
Aug 25, 2016, 6:11:53 AM8/25/16
to tas...@googlegroups.com
Could you work around it by assigning each automatic scene task (like focus in and out) a different task priority; that way they'd all run serially our maybe Int auto ones that that *can* run in parallel.

Sorry, shouldn't really suggest anything without knowing the codebase 😃
--
Boring .signature #1,423

Neil Bird

unread,
Aug 25, 2016, 6:14:34 AM8/25/16
to tas...@googlegroups.com
Actually while you're around: are the sizes of scenes' portrait and landscape views linked?

I had a decent portrait scene, then when I went to arrange a large-scale version of a slightly different size, the portrait one shrunk a lot.

I was wondering if the scene's core size was common?

On 25 August 2016 10:51:38 BST, Pent <crafty...@gmail.com> wrote:

--
Boring .signature #1,423

Pent

unread,
Aug 26, 2016, 3:59:35 AM8/26/16
to Tasker
Couldn't think of any 'proper' solution to this which isn't extremely painful
in terms of time and probable bugs.

For now, I will add a small delay to the 'gained focus' task, so the
'lost focus' task has a chance to record the value of %focused
via the first action being Variable Set, %this_element_focus, %focused

Pent

Neil Bird

unread,
Aug 26, 2016, 7:01:23 AM8/26/16
to tas...@googlegroups.com
On 26/08/16 08:59, Pent wrote:
> For now, I will add a small delay to the 'gained focus' task, so the
> 'lost focus' task has a chance to record the value of %focused
> via the first action being Variable Set, %this_element_focus, %focused

If it works ... :-)

--
[phoenix@fnx ~]# rm -f .signature
[phoenix@fnx ~]# ls -l .signature
ls: .signature: No such file or directory
[phoenix@fnx ~]# exit
Reply all
Reply to author
Forward
0 new messages