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 » Menus&Toolbars » bug in toolbar
Re: bug in toolbar [message #43946 is a reply to message #43930] Mon, 24 November 2014 11:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kropniczki wrote on Fri, 21 November 2014 18:36
Yep! I'm afraid it does! Updating windows library hasn't worked. Actually, it happens and disappears just like it comes. I'm working on the hypothesis that some other process might be messing with user32.dll. I'll try to track which process(es) is(are) using it and block its(their) execution to see what happens. Any suggestions?

tks.


What about putting a big loop doing just GetMouseLeft into ToolButton::Paint? Then try in some more trivial situation (like single normal Button::Paint).

Mirek
Re: bug in toolbar [message #43967 is a reply to message #43946] Tue, 02 December 2014 00:11 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Have been busy lately, sorry.

1. Added big Button (200 X 200) to GUI
class App : public TopWindow
{
	public:
	typedef App CLASSNAME;
	ToolBar bar;
	Button  btn;
	
	void DoNothing() {}

	void HandleBar(Bar& bar) {
		bar.Add("tip1", CtrlImg::copy(), THISBACK(DoNothing));
	}

	App()
	{
		Add(bar.HSizePos().TopPos(0, 30));
		bar.Set(THISBACK(HandleBar));
		btn.SetLabel("test").Tip("crash test");
		Add(btn.LeftPos(8, 200).TopPos(40, 200));
	}
};

GUI_APP_MAIN
{
	App().Run();
}


and inserted for-loop below into Button::Paint
void Button::Paint(Draw& w)
{
	for(int i = 0; i < 10000; i++)
		GetMouseLeft();
        ...


App crashes right after mouse pointer either enters or leaves Button rect, while jiggling mouse pointer inside Button area is not a problem.

Re: bug in toolbar [message #43968 is a reply to message #43946] Tue, 02 December 2014 00:24 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
A fact: no crashes observed when checking IsPainting() before executing loop
void Button::Paint(Draw& w)
{
    if(!IsPainting())                   // <- No Crashes!!
	for(int i = 0; i < 10000; i++)
		GetMouseLeft();



Hope it helps. Tks.
Re: bug in toolbar [message #43969 is a reply to message #43946] Tue, 02 December 2014 03:43 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Patching Win32Proc.cpp line #71 with
bool GetMouseLeft()   { AvoidPaintingCheck__(); return !!(GetKeyState(VK_LBUTTON) & 0x8000); }

resolved the problem, in spite of having added loops like
for(int i = 0; i < 10000; i++)
    GetMouseLeft();

to both ToolButton::Paint and Button::Paint. In other words, I was able to 'switch' problem on/off just by removing/adding patch above, respectively.

Just don't know about eventual (unforeseen) consequences (if any) of patch to Upp code as a whole...

tks!
Re: bug in toolbar [message #43981 is a reply to message #43969] Sat, 06 December 2014 18:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kropniczki wrote on Tue, 02 December 2014 03:43
Patching Win32Proc.cpp line #71 with
bool GetMouseLeft()   { AvoidPaintingCheck__(); return !!(GetKeyState(VK_LBUTTON) & 0x8000); }

resolved the problem, in spite of having added loops like
for(int i = 0; i < 10000; i++)
    GetMouseLeft();

to both ToolButton::Paint and Button::Paint. In other words, I was able to 'switch' problem on/off just by removing/adding patch above, respectively.

Just don't know about eventual (unforeseen) consequences (if any) of patch to Upp code as a whole...

tks!


Ha! That actually makes some sense: It is possible that something in your Windows setup routes GetKeyState through Window proc for some reason...

Thanks!

Mirek
Re: bug in toolbar [message #43982 is a reply to message #43981] Sat, 06 December 2014 18:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Fix: (commited, please check)

dword GetKeyStateSafe(dword what) {
	bool h = Ctrl::painting;
	Ctrl::painting = false;
	dword r = GetKeyState(what);
	Ctrl::painting = h;
	return r;
}

bool GetShift()       { return !!(GetKeyStateSafe(VK_SHIFT) & 0x8000); }
bool GetCtrl()        { return !!(GetKeyStateSafe(VK_CONTROL) & 0x8000); }
bool GetAlt()         { return !!(GetKeyStateSafe(VK_MENU) & 0x8000); }
bool GetCapsLock()    { return !!(GetKeyStateSafe(VK_CAPITAL) & 1); }
bool GetMouseLeft()   { return !!(GetKeyStateSafe(VK_LBUTTON) & 0x8000); }
bool GetMouseRight()  { return !!(GetKeyStateSafe(VK_RBUTTON) & 0x8000); }
bool GetMouseMiddle() { return !!(GetKeyStateSafe(VK_MBUTTON) & 0x8000); }

Re: bug in toolbar [message #43985 is a reply to message #43982] Sun, 07 December 2014 14:27 Go to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
mirek wrote on Sat, 06 December 2014 12:42
Fix: (commited, please check)


Done that, fix applied, many thanks! Smile
Previous Topic: Floating context menu
Next Topic: Menu and UHD on Windows
Goto Forum:
  


Current Time: Thu Mar 28 11:13:40 CET 2024

Total time taken to generate the page: 0.01089 seconds