|
|
Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » Ctrl::OverrideCursor
|
Re: Ctrl::OverrideCursor [message #14319 is a reply to message #9219] |
Fri, 22 February 2008 14:14 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
Ctrl::OverrideCursor() does not seem to react immediately (at least on Vista) but instead requires control to be returned to the system. I added SetMouseCursor(m) call to the CtrlMouse.cpp as follows and got immediate response:
Image Ctrl::OverrideCursor(const Image& m)
{
Image om = CursorOverride();
CursorOverride() = m;
DoCursorShape();
SetMouseCursor(m); // Added by tom
return om;
}
If you think it does not mess up anything else in UPP, please add it to the source. (The reason for immediate response requirement is that I need to show a wait cursor when processing some lengthy user mouse input requests.
// Tom
|
|
|
|
Re: Ctrl::OverrideCursor [message #14351 is a reply to message #14348] |
Sat, 23 February 2008 11:57 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
Sorry, I was inaccurate in my explanation. The problem requires that the OverrideCursor() is called from a context menu callback function to NOT to work. (I only thought of it as being a mouse operation as I used the mouse right clicking to open the context menu.)
Anyway, my fix does not appear to work on Linux as SetMouseCursor can not be called in static member funtion OverrideCursor without an object.
The reason the DoCursorShape does not work in this context is probably because the DoCursorShape requires an existing "mouseCtrl" which is not true in this case. So, I guess a proper fix would require a way to bypass a nonexistent mouseCtrl for an overridden mouse cursor. Or what do you think Mirek?
// Tom
|
|
|
|
Re: Ctrl::OverrideCursor [message #14359 is a reply to message #14355] |
Sat, 23 February 2008 17:21 |
Tom1
Messages: 1212 Registered: March 2007
|
Senior Contributor |
|
|
OK, here's the testcase. Today I'm on Linux and therefore I have no idea what happens when this is taken on Windows.
Anyway, on Linux none of the context menu callbacks work. The WaitCursor works neither on the context menu callback nor directly in MiddleUp. OverrideCursor works on LeftUp, but fails on context menu callback.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class Testcase : public TopWindow{
public:
typedef Testcase CLASSNAME;
Testcase(){
}
virtual void ContextMenu(Bar &bar){
bar.Add(t_("Lengthy process with OverrideCursor..."),THISBACK(LengthyProcess1));
bar.Add(t_("Lengthy process with WaitCursor..."),THISBACK(LengthyProcess2));
}
virtual void LengthyProcess1(){
// Not working on Linux:
Image cursor=OverrideCursor(Image::Wait());
Sleep(1000);
OverrideCursor(cursor);
}
virtual void LengthyProcess2(){
// Not working on Linux:
WaitCursor waitcursor;
Sleep(1000);
}
virtual void RightUp(Point p, dword keyflags){
MenuBar::Execute(THISBACK(ContextMenu));
}
virtual void LeftUp(Point p, dword keyflags){
// Working OK on Linux:
Image cursor=OverrideCursor(Image::Wait());
Sleep(1000);
OverrideCursor(cursor);
}
virtual void MiddleUp(Point p, dword keyflags){
// Not working on Linux:
WaitCursor waitcursor;
Sleep(1000);
}
};
GUI_APP_MAIN
{
Testcase().Run();
}
I think mouseCtrl might be null even though it should have a value. At least I can see the cursor on top of the Testcase window but still have no control over it using the above methods.
Just out of curiosity, which of the four cases work for you in XP? (When I get back to work on monday, I can test it on Vista.)
// Tom
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 03 00:20:39 CEST 2024
Total time taken to generate the page: 0.02249 seconds
|
|
|