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++ Library : Other (not classified elsewhere) » Exclamation("") and ESCAPE key
Exclamation("") and ESCAPE key [message #57250] Thu, 17 June 2021 10:45 Go to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I am experiencing an unwanted behaviour that bypass my control and let my users to perform weird things.
If I use

Exclamation("warning something");

to warn the eser that an EditString ctrl inside a GridCtrl cannot be empty, I see that the user may use the ESC key to close the esclamation window. Then he press again the ESC key and magically he entered a void string where it should never occur. If instead he use the "OK" button in Exclamation() then everything is OK.
The ESC key seems to work closing other windows.

The question is: is there a way to disable the ESC key when answering in a modal dialog?

Thanks,
Luigi
Re: Exclamation("") and ESCAPE key [message #57252 is a reply to message #57250] Thu, 17 June 2021 17:10 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
I saw that in CtrlLib, Prompt.cpp

struct PromptDlgWnd__ : TopWindow {
	bool    esc;
	Button *b;

	virtual bool HotKey(dword key) {
		if(TopWindow::HotKey(key))
			return true;
		if(IsAlpha(key))
			return TopWindow::HotKey(K_ALT_A + ToUpper((int)key) - 'A');
	//	if(key == K_ESCAPE && esc)  <----------------------this line
	//		b->PseudoPush();   <----------------------this line
		return false;
	}
};


if I comment the two lines shown above, the ESC key non longer works and the user should press the "OK" button.
Is this a dirty way to solve the problem? May it backfire?

Luigi

[Updated on: Thu, 17 June 2021 17:11]

Report message to a moderator

Re: Exclamation("") and ESCAPE key [message #57253 is a reply to message #57252] Thu, 17 June 2021 21:50 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Luigi,

Maybe you sould use EditString instead of LineEdit: it has a EditString::NotNull() method which does exactly what you are trying to do Wink
Ar at least it would show you how to do it whithout you're current problem
Re: Exclamation("") and ESCAPE key [message #57258 is a reply to message #57253] Sun, 20 June 2021 09:09 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

I was using already the NotNull feature.
Anyway I solved differently the issue.

Thnaks,
Luigi
Previous Topic: [PATCH] SDL2GUI (virtualgui) key handling improvements.
Next Topic: PdfDraw isn't linked in when compiling for Win on Linux using Clang-MinGW
Goto Forum:
  


Current Time: Fri Apr 19 02:26:20 CEST 2024

Total time taken to generate the page: 0.02350 seconds