AW: How to hilite a checkbox with send mouseup?
Nonsanity
form at nonsanity.com
Tue Feb 15 16:29:54 EST 2011
This works with a checkbox button...
Checkbox button named "Check":
on mouseUp
put the hilite of me into msg
end mouseUp
on MouseUpWithHilite
set hilite of me to not hilite of me
mouseup
end MouseUpWithHilite
Some other button:
on mouseUp
send MouseUpWithHilite to btn "Check"
end mouseUp
However it does not work so well with a regular button. The effects of
hilite on a regular button don't match the effect of clicking it. The effect
could probably be duplicated, but hilite isn't enough in itself. And it
would also need to be changed from a toggle effect to a delayed effect like
so:
on MouseUpWithHilite
set hilite of me to true
send StopHilite to me in 1 sec
mouseup
end MouseUpWithHilite
on StopHilite
set the hilite of me to false
end StopHilite
But as I said, the hilite by itself isn't enough. Probably need to add some
color change, etc.
This method has one advantage over "click at" however, in that it works even
if the checkbox is hidden, in another stack, behind another object, off the
edge of the card, or blocked by another window. The "click at" command would
fail to handle those situations properly.
~ Chris Innanen
~ Nonsanity
On Tue, Feb 15, 2011 at 12:30 PM, Robert Brenstein <rjb at robelko.com> wrote:
> On 15.02.11 at 12:14 -0500 Nonsanity apparently wrote:
>
>> It would be better to do something like add another handler to the button:
>>
>> on MouseUpWithHilite
>> set hilite of me to not hilite of me
>> mouseup
>> end MouseUpWithHilite
>>
>> And send THAT message to the button from afar. This way, the existing
>> MouseUp handler in the button works as expected, and this message has the
>> same result as clicking the button (toggling the hilite in the process)
>> and
>> enacting the MouseUp handler.
>>
>> ~ Chris Innanen
>> ~ Nonsanity
>>
>
> Chris,
>
> The above won't work as intended, it will turn the hilite on for good.
> You would need to add a delay and reverse the hilite before continuing with
> mouseUp.
>
> The click command simulates user physically clicking the button, which
> I believe was the effect that original poster wanted.
>
>
> Robert
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list