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 » How can I retrieve the current screen resolution?
How can I retrieve the current screen resolution? [message #5195] Sun, 10 September 2006 11:18 Go to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
Again I'm frantically browsing the documentation ... Confused Mad

I need to retrieve the current screen resolution.

I found "static Rect GetDefaultWindowRect();" but that's not exactly what I'm looking for. I don't want to use the "OS suggested rectangle of newly open window" but the *maximal* rectangle of a newly to open window.

I found

static bool ClickFocus()
Returns OS specific working area - this is rectangle in screen coordinates
where application windows can be placed.
Return value	Work area rectangle.


but that leaves me puzzled:

1.
The name is strongly misguiding. I found this function by pure chance.

2.
I'm unable to comprehend this function. How can a boolean value return the (size of the) work area rectangle?

OK! I'm sure that there does exist a simple function, e.g. "Size ScreenSize();", which returns the dimension of the current screen - 1280 * 1024 for example. Rolling Eyes

Where is it and how is it named? Shocked

Werner
Re: How can I retrieve the current screen resolution? [message #5198 is a reply to message #5195] Sun, 10 September 2006 14:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
GetClickFocus is wrong item.

Rect Ctrl::GetWorkArea();

It is not exactly screen resultion, but the rectangle of maximized window (in other words, screen resolution minus bottom start/tasklist pane).

Also please note that the window rectangle is specified without any platform specific border areas (so workarea is too big to be set as TopWindow rect).

Mirek
Re: How can I retrieve the current screen resolution? [message #5202 is a reply to message #5198] Sun, 10 September 2006 17:54 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sun, 10 September 2006 14:26

GetClickFocus is wrong item.

Rect Ctrl::GetWorkArea();

It is not exactly screen resultion, but the rectangle of maximized window (in other words, screen resolution minus bottom start/tasklist pane).

Also please note that the window rectangle is specified without any platform specific border areas (so workarea is too big to be set as TopWindow rect).

Mirek


Thank you very much. That was exactly what I was looking for. (I'm working on an application which has to adjust the TopWindow whenever the size of a certain widget changes.) Under Windows XP (without start bar) "GetWorkArea" returns exactly 1280 * 1024, 1024 * 768, 800 * 600, and so on.

May I suggest to honor this function by including it in the documentation? Rolling Eyes Or did I again fail to read the documentation carefully? Sad After all I couldn't find "GetWorkArea" in the documentation - even using "Find in files ..." (but in various files as soon as I knew what to look for ... Razz ).

Just because I'm curious and like to pester Twisted Evil : What is "GetClickFocus" for and how could I intelligently use it?

Werner

[Updated on: Sun, 10 September 2006 19:35]

Report message to a moderator

Re: How can I retrieve the current screen resolution? [message #5205 is a reply to message #5202] Sun, 10 September 2006 18:47 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Obviously, a bug in docs. Now fixed.

As for ClickFocus, it is flag that governs whether focus should be moved to some widgets when they are clicked. U++ has non-standard, but I believe visually better behaviour here - if you e.g. click Button, Option or Switch, focus is not moved to them (why it should, focus is important for adjusting them by keyboard, which is not what you do when clicking them by mouse). By calling ClickFocus, you can activate the "standard" behaviour.

Most likely this function (and some similiar as well) will be replaced by "Ch" flag.

BTW, in TopWindow.cpp is quite useful

void Maxisize(TopWindow& win, int screencxmax)
{
	if(Ctrl::GetWorkArea().Width() <= screencxmax)
		win.Maximize();
}


The intent is that most of my commercial apps are defined to run on 800x600 resulution, but can run on bigger screen as well. So if they are on 800x600, they start maximized (by Maxisize(app, 800)), on bigger resolution they are overlapped.

Mirek
Previous Topic: Implementation of TrayIcon for linux
Next Topic: these nice bubbles...
Goto Forum:
  


Current Time: Thu Apr 18 23:21:16 CEST 2024

Total time taken to generate the page: 0.02104 seconds