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++ Widgets - General questions or Mixed problems » Exclamation Popup: two clicks to dismiss
icon9.gif  Exclamation Popup: two clicks to dismiss [message #15208] Wed, 09 April 2008 16:22 Go to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
I don't know why I'm needing two clicks to dismiss an Exclamation popup box in this code.

I'm using lastFocus to store the focus of the last control and validate (in this case edtNSerie):

	if (lastFocus == &edtNSerie)
		{
			Sql sql(PSQL_SESSION);
			
			// observar si hay un caso abierto para el equipo
			sql.Execute(Format("SELECT numcaso FROM caso WHERE nserie='%s' AND estado!='CERRADO'",
			            ::ToUpper(TRIM((String)~edtNSerie))));     
			            
			sql.Fetch();
			
			if (sql.GetRowsProcessed())
			{
				Exclamation(Format("Este equipo ya tiene un caso abierto, numerado [* \%d].&"
				"Debe cerrar este caso para poder continuar.", sql[0] ));
				edtNSerie<<= "";
				lastFocus=NULL;
			}
...



That Exclamation call needs two clicks to return to the main dialog.

Why this behaviour?

Thank you, keep up the good work!

Re: Exclamation Popup: two clicks to dismiss [message #15317 is a reply to message #15208] Wed, 16 April 2008 10:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hard to say. My guess is that you might be calling Exclamation twice Wink

Another possibility is some sort of "modal loop crossing". Sometimes it can happen that you start another modal loop over the Examlamation's one accidentally. Exclamation can get closed only if its modal loop is exited.

Mirek
Re: Exclamation Popup: two clicks to dismiss [message #15350 is a reply to message #15317] Thu, 17 April 2008 06:08 Go to previous messageGo to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
luzr wrote on Wed, 16 April 2008 05:43

Hard to say. My guess is that you might be calling Exclamation twice Wink

Another possibility is some sort of "modal loop crossing". Sometimes it can happen that you start another modal loop over the Examlamation's one accidentally. Exclamation can get closed only if its modal loop is exited.

Mirek


Hi Mirek, my MainWindow it's opening modal windows with:

// suppose the window class to be opened is Dialog1

Dialog1 * dlg = new Dialog1();
dlg->Execute();
delete dlg;


May be this is the cause of the "two-click" problem?
Re: Exclamation Popup: two clicks to dismiss [message #15355 is a reply to message #15350] Thu, 17 April 2008 12:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Hard to say.

Anyway, the code you posted is really "anti-U++". Why not

Dialog1 dlg;
dlg.Execute();

?
Re: Exclamation Popup: two clicks to dismiss [message #15356 is a reply to message #15355] Thu, 17 April 2008 12:38 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
P.S.: If you can pack the app so that I can reproduce the problem, I can look into it...
Re: Exclamation Popup: two clicks to dismiss [message #15358 is a reply to message #15355] Thu, 17 April 2008 14:50 Go to previous messageGo to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
luzr wrote on Thu, 17 April 2008 07:37

Hard to say.

Anyway, the code you posted is really "anti-U++". Why not

Dialog1 dlg;
dlg.Execute();

?


Hehe, I don't remember why I arrived at using dynamic allocation. I tried using the form above and it works.

I'm packing up an example for my problem...
Re: Exclamation Popup: two clicks to dismiss [message #15359 is a reply to message #15356] Thu, 17 April 2008 15:08 Go to previous messageGo to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
luzr wrote on Thu, 17 April 2008 07:38

P.S.: If you can pack the app so that I can reproduce the problem, I can look into it...


Look, Mirek, I've packed a very small example. Try pressing TAB to exit the first edit control, the exclamation box appears and I need to do two-clicks to close.

Check if you're getting the same behaviour.

I'm using 2008.1 beta.

Thank you very much.


  • Attachment: Test.zip
    (Size: 1.09KB, Downloaded 283 times)

[Updated on: Thu, 17 April 2008 15:09]

Report message to a moderator

Re: Exclamation Popup: two clicks to dismiss [message #15362 is a reply to message #15359] Thu, 17 April 2008 15:56 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
indiocolifa wrote on Thu, 17 April 2008 16:08

luzr wrote on Thu, 17 April 2008 07:38

P.S.: If you can pack the app so that I can reproduce the problem, I can look into it...


Look, Mirek, I've packed a very small example. Try pressing TAB to exit the first edit control, the exclamation box appears and I need to do two-clicks to close.

Check if you're getting the same behaviour.

I'm using 2008.1 beta.

Thank you very much.


Hi!

Yes, your problem is easily reproducible. I don't know exactly why this is happening, but it is probably due to the popup window, which triggers another loose focus event because the focused window of the application has changed, and basically your running the code twice.

I attached a simple fix of the top of my hat for this kind of behavior. I'm sure there is a better way though.

One of them would be to use the Min and Max properties of edit1. You can do this in the designer. And also changing the type of EditTwo to EditStringNotNull.
  • Attachment: Test.zip
    (Size: 1.22KB, Downloaded 280 times)
Re: Exclamation Popup: two clicks to dismiss [message #15363 is a reply to message #15362] Thu, 17 April 2008 18:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Exactly.

The problem is that you will get ChildLostFocus for the editfield being left. Then prompt popups and you are getting another one (for the new editfield), BUT at that moment, you do not have your "lastFocus" changed yet (because you have not given it a chance to happen).

Actually, the real moral of the story is "do not change the focus in the process of changing the focus" Smile

Mirek
Re: Exclamation Popup: two clicks to dismiss [message #15377 is a reply to message #15363] Fri, 18 April 2008 03:05 Go to previous message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
luzr wrote on Thu, 17 April 2008 13:58

Exactly.

The problem is that you will get ChildLostFocus for the editfield being left. Then prompt popups and you are getting another one (for the new editfield), BUT at that moment, you do not have your "lastFocus" changed yet (because you have not given it a chance to happen).

Actually, the real moral of the story is "do not change the focus in the process of changing the focus" Smile

Mirek



I understand Mirek. Since U++ does not provide a "WhenLostFocus" style callback, what do you think it's the best approach to validate a field when the user leaves it (I need this).

Thank you very much for your help, both cbpporter and mirek.
Previous Topic: Equivalent widgets
Next Topic: Ctrl::GlobalBackPaintHint() and GLCtrl
Goto Forum:
  


Current Time: Mon Apr 29 14:17:16 CEST 2024

Total time taken to generate the page: 0.02314 seconds