1. wxEuphoria: wxEVT_MOUSEWHEEL Stuff
- Posted by cklester <cklester at yahoo.com> Dec 05, 2005
- 551 views
- Last edited Dec 06, 2005
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? :) Anyway, here's what it looks like... What need I do differently?! procedure adjust(atom this, atom event_type, atom id, atom event) atom item -- ?call_member(wxMouseEvent_GetWheelDelta,alist,{}) -- ?call_member(wxMouseEvent_GetWheelRotation,alist,{}) ?call_cdecl(wxMouseEvent_GetWheelRotation,{}) ?call_cdecl(wxMouseEvent_GetWheelDelta,{}) -- ?call_member(wxMouseEvent_GetWheelRotation,frame_Main,{}) end procedure set_event_handler( {frame_Main,alist}, -1, wxEVT_MOUSEWHEEL,routine_id( "adjust" )) -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/
2. Re: wxEuphoria: wxEVT_MOUSEWHEEL Stuff
- Posted by cklester <cklester at yahoo.com> Dec 05, 2005
- 552 views
- Last edited Dec 06, 2005
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? :) > > Anyway, here's what it looks like... What need I do differently?! > > procedure adjust(atom this, atom event_type, atom id, atom event) > atom item > -- ?call_member(wxMouseEvent_GetWheelDelta,alist,{}) > -- ?call_member(wxMouseEvent_GetWheelRotation,alist,{}) > ?call_cdecl(wxMouseEvent_GetWheelRotation,{}) > ?call_cdecl(wxMouseEvent_GetWheelDelta,{}) > -- ?call_member(wxMouseEvent_GetWheelRotation,frame_Main,{}) > end procedure > set_event_handler( {frame_Main,alist}, -1, > wxEVT_MOUSEWHEEL,routine_id( "adjust" )) Found out by studying mouse_event_position() that I need to use call_member_s( wxMouseEvent_GetWheelRotation, event, {}) which is new to me! :) -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/
3. Re: wxEuphoria: wxEVT_MOUSEWHEEL Stuff
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 06, 2005
- 541 views
posted by: cklester <cklester at yahoo.com> 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):
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
Matt Lewis
4. Re: wxEuphoria: wxEVT_MOUSEWHEEL Stuff
- Posted by cklester <cklester at yahoo.com> Dec 06, 2005
- 556 views
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/
5. Re: wxEuphoria: wxEVT_MOUSEWHEEL Stuff
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Dec 06, 2005
- 542 views
posted by: cklester <cklester at yahoo.com> > Why are you using a mouse wheel routine that emulates what the control > already does automatically? The editor control within wxIDE is emulated (I basically converted an old version of the editor that came with the win32lib IDE), so I have to manually scroll when the wheel is used. > 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. Looks OK to me. Matt Lewis