I just noticed something odd with the switch button widget:
The hiliteChanged command is triggered even if the hilite did not change, if you click outside the visible part of the switch button, but within the rect of the widget.
Example:
Code: Select all
on hiliteChanged
put the hilited of me after msg
end hiliteChanged
This causes errors if you only want something to happen if the user actually flips the switch (which is kind of the point with it). Of course, a workaround is to put things like ”if the hilite of me is true then…”. But there are still scenarios when that would not work - try this one for example:
Code: Select all
on hiliteChanged
if the hilite of me is true then add 1 to fld 1
else add -1 to fld 1
end hiliteChanged
Reducing the size of the widget rect doesn’t help, as the visual part then shrinks too, so the margin is constant. And there’s no margin property to set.
I’ve tried this in MacOS 10.13.4, Business 9.0.0 and Indy 8.1.9, both in IDE and standalone, and it’s the same. I haven’t tried in mobile (and touching the narrow area around the button without flipping it would be harder in mobile, so maybe less of a problem there).
I can figure out various scripting solutions to deal with this problem, so I’m not asking for advice on that.
I just wonder if this is a bug and if it’s known?
/Andreas