U++ framework
Do not panic. Ask here before giving up.

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: 14291
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 Jun 29 22:59:46 GMT+2 2026

Total time taken to generate the page: 0.00592 seconds