I am looking to create a tool tip for a button on a windows application,
and I have seen that the SDL documentation only refers to mouse button
events and not mouse motion events. Is this information hidden within
the SDL API, or will I need some other mechanism to display these tool
tips?
When I refer to a tool tip, I am talking about the ability to display
the use of a tool by holding the mouse cursor over the button and not
having to invoke it.
Robert
The ‘intro’ docs at libsdl.org mention this…
http://www.libsdl.org/intro/usingevents.html
* Polling event state
In addition to handling events directly, each type of event has
a function which allows you to check the application event state. If
you use this exclusively, you should ignore all events with the
SDL_EventState() function, and call SDL_PumpEvents() periodically to
update the application event state.
Example:
{
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
}
void CheckMouseHover(void)
{
int mouse_x, mouse_y;
SDL_PumpEvents();
SDL_GetMouseState(&mouse_x, &mouse_y);
if ( (mouse_x < 32) && (mouse_y < 32) ) {
printf("Mouse in upper left hand corner!\n");
}
}
… Might be useful chunk of code 
The SDL doc project specifically mentions SDL_MouseMotionEvent…
http://sdldoc.csn.ul.ie/eventstructures.php
http://sdldoc.csn.ul.ie/sdlmousemotionevent.php
I use mouse motion in Tux Paint to change the mouse pointer shape
(e.g., tool-specific shape when over the canvase, ‘hand’ shape when over
clickable buttons, arrow shape otherwise). I don’t do Tool Tips, tho…
Good luck!
-bill!
bill at newbreedsoftware.com "Hey Shatner, ya remember that episode of
Bill Kendrick Space Trek where your show got cancelled?"On Mon, Feb 09, 2004 at 02:21:37PM -0600, Robert Diel wrote:
I am looking to create a tool tip for a button on a windows application,
and I have seen that the SDL documentation only refers to mouse button
events and not mouse motion events. Is this information hidden within
the SDL API, or will I need some other mechanism to display these tool
tips?
I am looking to create a tool tip for a button on a windows application,
and I have seen that the SDL documentation only refers to mouse button
events and not mouse motion events. Is this information hidden within
the SDL API, or will I need some other mechanism to display these tool
SDL does include mouse motion events, and they definitely are included in
the documentation.
However, for your purposes SDL_GetMouseState might well be more
appropriate, as it returns (via pointer arguments) the coordinates of the
mouse rather than a relative distance of mouse motion.
JamesOn Mon, 09 Feb 2004 14:21:37 -0600, Robert Diel wrote:
Worked like a charm… Thank you all.On Mon, 2004-02-09 at 15:49, James Gregory wrote:
On Mon, 09 Feb 2004 14:21:37 -0600, Robert Diel wrote:
I am looking to create a tool tip for a button on a windows application,
and I have seen that the SDL documentation only refers to mouse button
events and not mouse motion events. Is this information hidden within
the SDL API, or will I need some other mechanism to display these tool
SDL does include mouse motion events, and they definitely are included in
the documentation.
However, for your purposes SDL_GetMouseState might well be more
appropriate, as it returns (via pointer arguments) the coordinates of the
mouse rather than a relative distance of mouse motion.
James
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Hi,
James Gregory wrote:
However, for your purposes SDL_GetMouseState might well be more
appropriate, as it returns (via pointer arguments) the coordinates of the
mouse rather than a relative distance of mouse motion.
SDL_MouseMotionEvent also contains absolute x and y coordinates, besides
the relative movement and the button state. See
http://sdldoc.csn.ul.ie/sdlmousemotionevent.php
Sebastian