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 » StaticRect blocks mouse events - deliberate?
StaticRect blocks mouse events - deliberate? [message #5420] Wed, 20 September 2006 17:12 Go to next message
James Thomas is currently offline  James Thomas
Messages: 26
Registered: June 2006
Promising Member
Here is a quick example:
#include <CtrlLib/CtrlLib.h>

class AWindow : public TopWindow
{
public:
	typedef AWindow CLASSNAME;
	StaticRect r;

	AWindow()
	{
		Add(r);
		r.Color(SBlack);
		r.SetPos(r.PosLeft(10, 100), r.PosTop(10, 100));	

		SetPos(r.PosLeft(0, 200), r.PosTop(0, 100));
	}
	
	// Events	
	virtual void RightDown(Point p, dword keyflags) 
	{
		PromptOK("Right mouse button event");
	}
};

GUI_APP_MAIN
{
	AWindow w;

	w.Run();
}


When it's run a window opens with a black rectangle in it. If you click outside the rectangle you get a prompt, inside nothing happens.

This seems like pretty unhelpful behaviour and I can't see any reason for it in the StaticRect source. LabelBox and StaticText correctly pass the event up to the parent window.

Is this the way it's supposed to work?
Re: StaticRect blocks mouse events - deliberate? [message #5421 is a reply to message #5420] Wed, 20 September 2006 19:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
James Thomas wrote on Wed, 20 September 2006 11:12

Here is a quick example:
#include <CtrlLib/CtrlLib.h>

class AWindow : public TopWindow
{
public:
	typedef AWindow CLASSNAME;
	StaticRect r;

	AWindow()
	{
		Add(r);
		r.Color(SBlack);
		r.SetPos(r.PosLeft(10, 100), r.PosTop(10, 100));	

		SetPos(r.PosLeft(0, 200), r.PosTop(0, 100));
	}
	
	// Events	
	virtual void RightDown(Point p, dword keyflags) 
	{
		PromptOK("Right mouse button event");
	}
};

GUI_APP_MAIN
{
	AWindow w;

	w.Run();
}


When it's run a window opens with a black rectangle in it. If you click outside the rectangle you get a prompt, inside nothing happens.

This seems like pretty unhelpful behaviour and I can't see any reason for it in the StaticRect source. LabelBox and StaticText correctly pass the event up to the parent window.

Is this the way it's supposed to work?



Yes.

Anyway, you can easily acquire opposite behaviour - just call IgnoreMouse for it (which is what LabelBox and StaticText (LabelBoc base) do.

Sure, there is question whether that should not be the default behaviour. I never got cought by this, so we left it as it is.
Re: StaticRect blocks mouse events - deliberate? [message #5430 is a reply to message #5420] Thu, 21 September 2006 12:02 Go to previous message
James Thomas is currently offline  James Thomas
Messages: 26
Registered: June 2006
Promising Member
Thanks. I think I was slightly confused about what IgnoreMouse did (assuming that IgnoreMouse would make it block the event, and not the other way around) but that clears things up.
Previous Topic: How to call instance in main.cpp
Next Topic: Change ToolTip speed?
Goto Forum:
  


Current Time: Thu Mar 28 18:00:32 CET 2024

Total time taken to generate the page: 0.01033 seconds