Problems with segmented control widget
benr at cogapp.com
Fri Aug 30 05:19:05 EDT 2019
I forgot to mention that both these issues can be worked around - but
surprisingly, the second is easier than the first.
Using "wait 0 seconds with messages" after changing the hilitedItems allows
the hiliteChanged message to be processed immediately; but even then testing
the lockMessages is unhelpful - it's always false (presumably because it's in
a different thread? Although I thought that lockMessages was a global property?)
So the complete solution is to have a global set to mirror lockMessages, and
wait with messages whenever the state is changed by script.
Anyway, my real question is: is it just a bug, fixable in the widget
definiton, that messages emitted by some widgets (at least Navbar is the same)
are not handled in the same way as native controls? Or is this a fundamental
limitation of LCB?
On 30/08/2019 09:30, Ben Rubinstein via use-livecode wrote:
> I've been using this widget and found some issues. Before I report the bug(s)
> I want to check if I'm missing some knowledge or understanding.
> At various times I need to change the hilitedItems on the control by script;
> at other times I need to react when the user does so. For the latter case I
> respond to the "hiliteChanged" message.
> The problem came when I change the hilitedItems by script: it triggered
> hiliteChanged causing all sorts of hilarity. I had trouble tracking it down
> because when I stepped through the code I couldn't see any point when the
> problems occurred. Setting lockMessages didn't help. And even when I checked
> the lockMessages in my hiliteChanged handler, the aberrant behaviour continued..
> After further investigation, the upshot is that there are two issues:
> - the widget pays no attention to the lockMessages in deciding to post
> - although it redraws immediately in response to a change in hilitedItems, the
> hiliteChanged message (or potentially multiple messages stacked up) is not
> sent until idle time.
> (The latter issue explains my problem with spotting where the issue was
> occurring, and also why checking the lockMessages in my hiliteChanged handler
> didn't help - because by the time the handler was invoked, the lockMessages
> *was* false.)
> The first issue is presumably straightforward to address.
> Is there some fundamental property of widgets that make it impossible to fix
> the second issue?
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the use-livecode