Re: EuGTK - GTK_SELECTION_SINGLE?

new topic     » goto parent     » topic index » view thread      » older message » newer message

If you want to respond to a single-click of a mouse button, try connecting a generic event to the treeview/listview, then filtering the events to respond only to one particular mouse event:

function Foo(atom ctl, atom event) 
if peek(event) = 7 then -- mouse button released 
 if peek(event+40) = 1 then -- mouse left button 
  puts(1,get(tv,"text",column#)) 
 end if 
end if 
return 0 
end function 
constant foo = call_back(routine_id("Foo")) 
 
connect(tv,"event",foo) 

We wait for the button release, rather than getting the contents of the tv on mouse pressed (since the focus may not have changed to the control where the mouse is now sitting).

Alternate way, if you need the button #:

if peek(event) = 4 then -- some mouse button pressed 
 whichbtn = peek(event+40) -- 1, 2, or 3 == left, mid, right 
... 

Responding to a single-click means you can't select multiple items via "rubber banding". You still have ctl-click for that.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu