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 » TopWindow&PopUp, TrayIcon » Bug: TopMost blocks Prompt dialog
Bug: TopMost blocks Prompt dialog [message #18822] Fri, 24 October 2008 16:04 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
The problem:
- You have a child window (opened with TopWindow::Open(this)) with TopMost(true, true) set.
- The parent window opens a Prompt (PromptOK etc)
- If the TopMost child window is in the center of the parent (where the Prompt will appear) then the prompt dialog is invisible, hidden behind the child window.
- Because the prompt is run with RunAppModal it is not possible to move the child window to reveal it, effectively locking up the application. You can hit return/escape to clear it but that's not ideal as the user may not even realise a prompt has been opened.

This is only a fatal problem on Windows, as on X11 the WM still allows you to move windows even with an AppModal dialog running.

My fix:
Setting TopMost on the prompt dialog before it's opened seems to fix it.

Test package attached. Tested against the svn version (2008.1 is actaully worse since you can't even use return/escape to clear the prompt)

[Updated on: Fri, 24 October 2008 16:05]

Report message to a moderator

Re: Bug: TopMost blocks Prompt dialog [message #18914 is a reply to message #18822] Fri, 31 October 2008 15:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Fri, 24 October 2008 10:04

The problem:
- You have a child window (opened with TopWindow::Open(this)) with TopMost(true, true) set.
- The parent window opens a Prompt (PromptOK etc)
- If the TopMost child window is in the center of the parent (where the Prompt will appear) then the prompt dialog is invisible, hidden behind the child window.
- Because the prompt is run with RunAppModal it is not possible to move the child window to reveal it, effectively locking up the application. You can hit return/escape to clear it but that's not ideal as the user may not even realise a prompt has been opened.

This is only a fatal problem on Windows, as on X11 the WM still allows you to move windows even with an AppModal dialog running.

My fix:
Setting TopMost on the prompt dialog before it's opened seems to fix it.

Test package attached. Tested against the svn version (2008.1 is actaully worse since you can't even use return/escape to clear the prompt)


Well, this is one little nast problem...

The problem is that TopMost in Prompt in all cases does not sound too good from user perspective. IMO, user still wants to see some other app else when Prompt appears.

In the end, I have used this desperate solution:

	dlg.Open();
	Vector<Ctrl *> wins = Ctrl::GetTopWindows();
	for(int i = 0; i < wins.GetCount(); i++) {
		TopWindow *w = dynamic_cast<TopWindow *>(wins[i]);
		if(w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) {
			dlg.TopMost();
			break;
		}
	}
	dlg.Title(title);
	return dlg.RunAppModal();


Mirek
Re: Bug: TopMost blocks Prompt dialog [message #20357 is a reply to message #18914] Fri, 13 March 2009 14:09 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
luzr wrote on Fri, 31 October 2008 14:21


In the end, I have used this desperate solution:

	dlg.Open();
	Vector<Ctrl *> wins = Ctrl::GetTopWindows();
	for(int i = 0; i < wins.GetCount(); i++) {
		TopWindow *w = dynamic_cast<TopWindow *>(wins[i]);
		if(w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) {
			dlg.TopMost();
			break;
		}
	}
	dlg.Title(title);
	return dlg.RunAppModal();


Mirek

I've discovered that this doens't work on X11. For whatever reason TopMost must be set before the window opens. On Win32 however, it only works the other way round Rolling Eyes

I changed my version to:
#ifdef PLATFORM_WIN32
	dlg.Open();
#endif
	Vector<Ctrl *> wins = Ctrl::GetTopWindows();
	for(int i = 0; i < wins.GetCount(); i++) {
		TopWindow *w = dynamic_cast<TopWindow *>(wins[i]);
		if(w && w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) {
			dlg.TopMost();
			break;
		}
	}	
#ifdef PLATFORM_X11
	dlg.Open();
#endif

but obviously that's a bit of a horrible bodge.
Re: Bug: TopMost blocks Prompt dialog [message #20389 is a reply to message #20357] Mon, 16 March 2009 10:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, maybe we should just put "TopMost" to Prompt when *any* of owned windows has "TopMost" ?

Mirek
Re: Bug: TopMost blocks Prompt dialog [message #20391 is a reply to message #20389] Mon, 16 March 2009 11:46 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
luzr wrote on Mon, 16 March 2009 09:53

Well, maybe we should just put "TopMost" to Prompt when *any* of owned windows has "TopMost" ?

Mirek

That seems perfectly reasonable, although the previous solution also works fine providing TopMost is called at the correct place.
Re: Bug: TopMost blocks Prompt dialog [message #20464 is a reply to message #20391] Thu, 19 March 2009 23:00 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Mon, 16 March 2009 06:46

luzr wrote on Mon, 16 March 2009 09:53

Well, maybe we should just put "TopMost" to Prompt when *any* of owned windows has "TopMost" ?

Mirek

That seems perfectly reasonable, although the previous solution also works fine providing TopMost is called at the correct place.


Well, it cries "implementation defined / undefined" to me Smile

I have removed checking the Rect in trunk version, for now. I hope it will work OK. (You might want to check, perhaps Wink

Mirek
Previous Topic: Howto Drop Files into a TopWindow please?
Next Topic: starting program hidden and putting it in start up
Goto Forum:
  


Current Time: Thu Apr 25 01:11:17 CEST 2024

Total time taken to generate the page: 0.03112 seconds