Is there a way to catch mouseRelease in LCB?

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4016
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Is there a way to catch mouseRelease in LCB?

Post by bn » Fri Sep 25, 2015 9:26 am

When testing the gradientEditor in LC 8 DP 5 I noticed that when you release the mouse off the card of the property inspector the mouseMove handler is still working, i.e. the last selected index moves along when returning to the gradientEditor with the mouse being up. This stops when you click on the gradientEditor.

I had a look at the code and the onMouseUp handler does not fire in gradientEditor when the mouse is released outside the bounds of the card the widget is on.

The question is if that behavior of the onMouseUp message the way it is supposed to be?
Or another way around should there be a onMouseRelease message?

(I found a workaround for this problem but it is awkward)

Kind regards
Bernd

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 192
Joined: Thu Apr 18, 2013 2:48 pm

Re: Is there a way to catch mouseRelease in LCB?

Post by livecodeali » Sat Sep 26, 2015 5:11 pm

There isn't - but perhaps OnMouseCancel will work for this purpose?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4016
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Is there a way to catch mouseRelease in LCB?

Post by bn » Sun Sep 27, 2015 8:37 am

Hi Ali,
There isn't - but perhaps OnMouseCancel will work for this purpose?
That works perfectly, OnMouseCancel triggers when releasing the mouse outside of the bounds of the card the widget is on.

Thank your very much

Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4016
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Is there a way to catch mouseRelease in LCB?

Post by bn » Sun Sep 27, 2015 2:55 pm

here is the pull-request for gradientrampeditor with OnMouseCancel.

https://github.com/livecode/livecode/pull/2930

Kind regards
Bernd

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1211
Joined: Thu Apr 11, 2013 11:27 am

Re: Is there a way to catch mouseRelease in LCB?

Post by LCMark » Mon Sep 28, 2015 8:00 am

Hi Bernd - I'll have to check there isn't a bug here. My original intent was that you should get mouseup regardless of where the mouse is released, mousecancel being reserved for situations where a change in UI context means the mouseup isn't for the target widget. E.g. Popping up a context menu on mouseDown - as soon as the popup has occurred the widget won't get a mouseup (which is now for the popup to process) but mousecancel instead. In the case of releasing outside the window, a mouseUp should still occur as he widget has grabbed mouse input.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4016
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Is there a way to catch mouseRelease in LCB?

Post by bn » Mon Sep 28, 2015 8:48 am

Hi Mark,

thank you for explaining.
In the case of releasing outside the window, a mouseUp should still occur as he widget has grabbed mouse input.
if that works my pull request is superfluous.
mousecancel being reserved for situations where a change in UI context means the mouseup isn't for the target widget. E.g. Popping up a context menu on mouseDown - as soon as the popup has occurred the widget won't get a mouseup (which is now for the popup to process) but mousecancel instead
that is what I gathered from the dictionary so I did not even try it.

BTW in gradientrampeditor is a OnKeyPressed handler. I have not gotten it to trigger at all. But that might be because I don't know how it is supposed to work. If it is supposed to work while the widget "is active" (has focus?) then it did not trigger when pressing a key. This is of course all new to me and I use the provided widgets to learn about LCB.

Another thing I would like to add. I think LC 8 looks very promising. I like the way it uses widgets for the UI. It is a lot cleaner and confined than before. Once all the little quirks of this huge rework of even the IDE are worked out I see that LC IDE will be a lot easier to maintain and expand/adapt.

In a broader sense since this applies to all of LC then I start to see where you are heading and I think it is huge.

Thank you for all the work you and the LC team has put into this. It is well worth the wait for it mature. And also worth getting used to the LCB-language :)

Kind regards
Bernd

Post Reply

Return to “LiveCode Builder”