handling of mouse messages in widgets

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

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 993
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas

Re: handling of mouse messages in widgets

Post by trevordevore » Wed Aug 19, 2015 7:20 pm

@LCMark - How do you see the dragStart/Move/End messages being handled? Currently widgets do not pass those messages automatically and it seems that they should as drag should be handled in LC Script most of the time.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: handling of mouse messages in widgets

Post by pthirkell » Sat Aug 29, 2015 3:12 am

OK well as Martin said, some of this discussion is above my pay grade! I have however been playing around in earnest with widgets since DP 3 was released, and have a couple of observations to make.

Firstly, it is probably obvious to the experienced among you, but I've just discovered that widgets support behaviors. This is very exciting and a big deal, because I will be able to replace buttons (which I drag around as nodes in a visual network on screen) with better configured widgets that will allow much more functionality (and visual appeal) for each node object.

This raises again however the question of what mouse messages widgets should (or shouldn't) receive. There was quite a discussion earlier in this thread on the point that buttons for example serve a very specific purpose - i.e. click on the button and it triggers an instruction or whatever. However I use buttons for quite a different purpose ... as objects that can be dragged around, made bigger and smaller, connected together with arrows, displaying different images selected by the user etc ... not at all the 'normal' purpose of a button. Initially I used graphic objects, but the advantage of buttons is that they can display an icon and show text, and so all of my "nodes" are in fact buttons. I plan with LC 8 to replace these buttons with widgets ... but I really hope that the commands routinely used to manage and move around my 'buttons' (mousedown, mouseup, mousemove, dragstart, dragenter, dragdrop etc) will still work by default with widgets.

What prompts me to write now is Trevor's comment that the 'mousemove' message doesn't seem to work with widgets. Is this a bug or an intended behaviour? There is a workaround ... (on mousestilldown; set the loc of me to the mouseloc; end mousestilldown) ... but it isn't nearly as smooth as mousemove - and also means that a number of my scripts will need to be rewritten as I replace my 'buttons' with widgets.

Of course I may be a bit weird in the way that I use buttons and will understand if there are more elegant solutions for how widgets should generally handle mouse messages. Nonetheless I thought that it might be helpful to report on how I use buttons in practice - in support of the comments by one or two others that you really can't predict how developers will use widgets in practice.

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 312
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: handling of mouse messages in widgets

Post by jameshale » Wed Mar 01, 2017 2:55 am

So has anything come of this discussion?
It seems to have covered most bases and come to a near consensus as to the direction Mark was outlining but this was almost two years ago.
I have added a link to this discussion to http://quality.livecode.com/show_bug.cgi?id=17424 as this bug seemed closest to relevance.

Posts: 4
Joined: Fri Mar 23, 2012 10:37 pm

Re: handling of mouse messages in widgets

Post by xsymetrix » Sun Jul 08, 2018 1:24 am

This seems to potentially deal with the problem I have in the native slider where I put the value into a field using "onvaluechanged" but if I include code to go to another card and display the number of students based on the slider value, the jump to the card occurs before the user has moved the slider to the desired location.

Having something within the widget that deals separately with the mousedown/mouseup (or ignores it) would definitely be helpful in the case of a slider being dragged to a location and the finger (mouse) released from the slider thumb.

Post Reply

Return to “LiveCode Builder”