Problems with segmented control widget

Ben Rubinstein benr_mc at cogapp.com
Fri Aug 30 04:30:17 EDT 2019


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 
"hiliteChanged"

- 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?

TIA,

Ben




More information about the use-livecode mailing list