Hack for Linux wxGrid mousewheel bug

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
Ed Welch
In need of some credit
In need of some credit
Posts: 4
Joined: Sun Sep 05, 2004 9:18 pm
Location: Spain

Hack for Linux wxGrid mousewheel bug

Post by Ed Welch » Sun Jan 23, 2005 12:01 pm

You may have noticed the mouse wheel scrolling does not work for the wxGrid under Linux.
Here is a simple, but effective work-around (add to your wxGrid-drived class):

Code: Select all

BEGIN_EVENT_TABLE(EzGrid, wxGrid)
#ifdef __WXGTK__
    EVT_MOUSEWHEEL(EzGrid::OnMouseWheel)
#endif
END_EVENT_TABLE()

#ifdef __WXGTK__
void EzGrid::OnMouseWheel( wxMouseEvent& event )
{
        int nWheelRotation = event.GetWheelRotation();
	int x, y;
	GetViewStart(&x, &y);
	if (nWheelRotation < 0) y+=5;
	else y -= 5;
	Scroll(x, y);
}
#endif

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: Hack for Linux wxGrid mousewheel bug

Post by Ryan Norton » Tue Jun 28, 2005 3:36 am

This might make a good patch to wxGrid I think...
[Mostly retired moderator, still check in to clean up some stuff]

Post Reply