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  |
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   |
 |
mirek
Messages: 14255 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.
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 20:31:17 CEST 2025
Total time taken to generate the page: 0.02159 seconds
|