Home Download Buy Blog Forum Support

How does drag_select work?

How does drag_select work?

Postby adzenith on Tue Jun 26, 2012 4:45 pm

If I click, drag_select gets called only once. If I click and hold, then move the mouse around to select a bunch of text, drag_select still only gets called once, yet it somehow continues to work—modifying my selection as I drag—after it returns. Does drag_select itself just start some handler that reads the mouse state directly? Is there any way I can check the state of the mouse myself, or otherwise capture mouse-down and mouse-up?
Additionally, drag_select translates screen x and screen y into a text_point. Is this functionality exposed through the API?
Thanks!
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: How does drag_select work?

Postby jps on Thu Sep 06, 2012 1:23 pm

drag_select makes use of functionality that only exists on the C++ side of things, namely the ability to capture mouse events over time, and the ability to talk in window coordinates. It's unlikely that raw event handling will be exposed in the API.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: How does drag_select work?

Postby adzenith on Thu Sep 06, 2012 9:55 pm

Got it, thanks.

Will there be an api for clicks in general in the future, even if they're not using window coordinates? Maybe something like:
on_pre_click(view, text_point) -> return False to cancel drag_select's functionality
on_post_click(view, text_point)

This could allow e.g. clicking on hyperlinks to open webpages, or making clickable help-docs or whatever. Or text-based dropdown menus!
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: How does drag_select work?

Postby xeno.by on Thu Sep 06, 2012 10:19 pm

This is already sort of possible with the technique described here: viewtopic.php?f=6&t=7658. I would love native support as well, of course.
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 15 guests