2022-01-10 04:38 AM
Hi,
Why isn't there a function setDraggable() in the Drawable class, the same way there is a setTouchable() function ? (as of now, the setTouchable() serves too to prevent the dragEvents to be received by a given widget)
I'm asking because many times, I'd like my widgets to receive clickEvents but not dragEvents (that must be received by their parent containers).
Is there any reason for the lack of such a function?
Thanks.
2022-02-21 06:58 AM
Hello @GMeur ,
There are two main reasons why this functionality isn't implemented in the Drawable class :
Maybe you could give us a detailed example of an user case in which that function could be useful ?
Thanks,
/Yoann
2022-02-21 11:34 PM
Hi,
Thanks for your answer. An example would be a scrollablePagesContainer with a huge editable field in one page (that acts as a button). In that case, I don't want the dragEvents to be received by the editable field but by the scrollablePagesContainer. However, as I'm writing those lines, I realise it may not be that simple as I think the first ClickEvent must be received by both elements in order for them to work fine…
Indeed, it's exactly what I'm doing right now : I'm intercepting the dragEvents in the button and just passing them to its parent container (the scrollablePagesContainer), but I'm managing the ClickEvents differently as the first one is received by both the button and the scrollablePagesContainer (I copy it in the button and resent it) and after, I decide what to do with the release Event (send it to the button or to the scrollablePagesContainer depending on the delta of the drag).
2022-02-22 06:56 AM
Hello,
Thanks for your input.
I perfectly understand what you want to do, and why it could be useful to be able to separate Drag and Click events.
For the moment, we are not planning to implement that functionality.
I also think that your solution to redirect events based on the delta of the drag is a good way to determine if the user wants to click on the widget or drag it.
Sorry that I couldn't help you more,
/Yoann