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 » How do I get a window decoration/element size
How do I get a window decoration/element size [message #43394] Wed, 23 July 2014 16:16 Go to next message
awksed is currently offline  awksed
Messages: 61
Registered: April 2012
Member
Hi,

How do I get a window element size, e.g. title bar height, V scrollbar width? Preferably before I create the window.

Thanks.
Re: How do I get a window decoration/element size [message #43857 is a reply to message #43394] Mon, 10 November 2014 16:48 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Please note that U++ is responsible for the window inner contents. The decorations around the window are a subject to control by window manager (U++ has limited set of routines to control it).
I'm afraid there's no portable (window manager - agnostic) way of detecting decoration parameters, that is why U++ doesn't contain methods for detecting them.
So please consult documentation on window manager you use (WinAPI, Gnome, etc.).

[Updated on: Mon, 10 November 2014 16:48]

Report message to a moderator

Re: How do I get a window decoration/element size [message #44423 is a reply to message #43394] Tue, 10 March 2015 10:42 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Here's a (ugly) workaround that will give you some values:

...
int WFrameWidth, TitleBarHeight;

void Get_WFW_TBH()
{
	TopWindow w,w1;
	w.SetRect(10,10,10,10); 
	w.OpenMain();
	w1.SetRect(w.GetRect());
	w1.OpenMain();
	Rect rw=w.GetRect();
	Rect rw1=w1.GetRect();
	WFrameWidth=rw1.left-rw.left; //left-frame thickness
	TitleBarHeight=rw1.top-rw.top;
	w.Close();
	w1.Close();
}


I use it on Linux to get retain exact positioning of topwindows between sessions.
There's a quick flash of the two windows (easily not noticed Wink
Don't know how portable (should be OK)
(MSWindows has built-in functions to get those values, I think, but the code should work even there)
Previous Topic: Raspberry PI
Next Topic: ERROR: INVALID UTP-8 SEQUENCE: n Ya que el equpo d
Goto Forum:
  


Current Time: Fri Mar 29 08:29:47 CET 2024

Total time taken to generate the page: 0.01239 seconds