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 » Community » Newbie corner » App "swallowing" mouseclicks
App "swallowing" mouseclicks [message #58779] Tue, 30 August 2022 06:21 Go to previous message
peterh is currently offline  peterh
Messages: 108
Registered: November 2018
Location: Germany
Experienced Member
Hi I compiled the tutorial sample "Gui21" "creating and using custom widgets".
It derives a widget from "Ctrl".

Just the code as a reminder:
 
struct MyCtrl : public Ctrl {
	int count = 0;

	virtual void Paint(Draw& w) override {
		w.DrawRect(GetSize(), White());
		w.DrawText(2, 2, AsString(count));
	}

	virtual void LeftDown(Point, dword) override {
		count++;
		Refresh();
	}
};

I made then an experimental program, deriving not from "Ctrl", but deriving from "EditString".
Using this, I noticed, it does pretty often "swallow" mouseclicks, this means it does not react to them.

Then I tried the original code again and this "swallows" mouseclicks too, not so often but randomly about 1 out of 10 clicks.

It happens (reliably) both in debug and release mode.
I am on nightly build 16323, Win10 64 bit, using Clang 64 bit.

The computer is pretty fast, Ryzen 7 and CPU load in Task Manager is close to zero on all 16 cores.

Testproject code:
Main:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct MyCtrl : public EditString {
	int count = 0;

	virtual void Paint(Draw& w) override {
		//w.DrawRect(GetSize(), White());
		EditString::Paint(w);
		w.DrawText(2, 2, AsString(count));
	}
	

	virtual void LeftDown(Point p, dword d) override {
		count++;
	   //Refresh();
		EditString::LeftDown(p,d);
	}
	
};

#define LAYOUTFILE <Gui21/Gui21.lay>
#include <CtrlCore/lay.h>

struct Gui21 : public WithGui21Layout<TopWindow> {
	Gui21();
};

Gui21::Gui21()
{
	CtrlLayout(*this, "Window title");
}

GUI_APP_MAIN
{
	Gui21().Run();
}

Ctrllib.usc
ctrl MyCtrl {
	>EditString;
}

Gui21.lay
LAYOUT(Gui21Layout, 216, 144)
	ITEM(MyCtrl, myctrl, Tip(t_("Test")).LeftPosZ(44, 120).TopPosZ(36, 52))
	ITEM(Upp::EditString, dv___1, LeftPosZ(44, 64).TopPosZ(96, 19))
END_LAYOUT



It "swallows" fast mouseclick sequences preferrably.
Edit:
I believe, I know the reason: EditString "swallows" clicks, when it detects a double click.

[Updated on: Wed, 31 August 2022 13:25]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Linking error with imagefile
Next Topic: [solved] Widget events - any other than WhenAction ?
Goto Forum:
  


Current Time: Sat May 11 07:10:48 CEST 2024

Total time taken to generate the page: 0.02926 seconds