Re: wxEuphoria: wxEVT_MOUSEWHEEL Stuff

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

Matt Lewis wrote:
> cklester wrote:
> > > I'm capturing the mousewheel movement, but can't figure out if the wheel
> > > is
> > > going + or -. The control is a wxListCtrl. Interestingly... the event is
> > > triggered with a CTRL+Scroll instead of a regular scroll. That's nice, but
> > > is it intended? :)
> > Found out by studying mouse_event_position() that I need to use
> >     call_member_s( wxMouseEvent_GetWheelRotation, event, {})
> > which is new to me! :)
> Here is my routine for wxIDE (see wxIDE_Syntax.e):
> }}}
<eucode>
> procedure onMouseWheel_Syntax( atom this, atom event_type, atom id, atom event
> )
> 	integer rotation
> 
> 	rotation = floor( call_member_s( wxMouseEvent_GetWheelRotation, event, {}) /
> 40 )
> 	Void = get_scroll_position( SynVScroll )
> 	set_scroll_position( SynVScroll, Void - rotation )	
> 	set_focus( Syntax )
> 	refresh_window( Syntax )
> end procedure
> </eucode>
{{{


Why are you using a mouse wheel routine that emulates what the control
already does automatically? I was needing the routine to capture if the
CTRL key was being pressed so I could make it adjust the font size of
the text in the control. It works pretty nicely, except there are some
bizarre display bugs sometimes. Maybe a refresh_window() would help.

My code looks something like this:

procedure FontSizeAdjust(...)
if CTRLisDown() then
   -- adjust font size depending on direction of scroll
else
   skip( event ) -- so normal processing of scroll can occur
end if
end procedure

Let me know if there's something wrong with that.

-=ck
"Programming in a state of Euphoria."
http://www.cklester.com/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu