Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Changing mouse icon with MouseEvent
Re: Changing mouse icon with MouseEvent [message #54803 is a reply to message #54802] Thu, 17 September 2020 11:57 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14257
Registered: November 2005
Ultimate Member
koldo wrote on Thu, 17 September 2020 11:22
Thank you Mirek

Unfortunately the code always shows a hand.
Next option works, although it probably could be improved:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : TopWindow {
	bool showHand = false;
	
	virtual void LeftDown(Point, dword) 	{showHand = true;}
	
	virtual void LeftUp(Point, dword) 	{showHand = false;}
	
	virtual Image CursorImage(Point, dword) {
		if (showHand)
			return Image::Hand();
		else
			return Image::Arrow();
	}
};

GUI_APP_MAIN
{
	App().Run();	
}


This works.

Note that you have not said in the previous post what you really want to achieve... Smile

Simpler solution:

struct App : TopWindow {
	virtual Image MouseEvent(int event, Point, int, dword) {
		if (event == CURSORIMAGE && GetMouseLeft()) 
			return Image::Hand();
		return Image::Arrow();
	}
};
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [GlCtrl] Integration and use of Glad loader instead of Glew
Next Topic: Background color of StaticText or EditString
Goto Forum:
  


Current Time: Mon May 12 23:13:07 CEST 2025

Total time taken to generate the page: 0.08804 seconds