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 » [Closed] Get size and position of widget
[Closed] Get size and position of widget [message #48767] Wed, 13 September 2017 09:05 Go to previous message
rafiwui is currently offline  rafiwui
Messages: 105
Registered: June 2017
Location: Stuttgart, Germany
Experienced Member
I try to write an auto resizing app and so I need to know how to get the position and size of all widgets correct, because the solution I worked out has kind of a bug/problem:
index.php?t=getfile&id=5391&private=0
This is how it looks

index.php?t=getfile&id=5392&private=0
This is how it should look
And here is the Layout file:
LAYOUT(TestSimpleLayout, 400, 200)
	ITEM(Clock, m_widget, LeftPosZ(16, 368).TopPosZ(20, 156))
END_LAYOUT


The code of the resizing is shown here:
void TestWindow::Layout()
{
	float sizeXChange = (float)GetSize().cx / (float)m_startSize.cx;
	float sizeYChange = (float)GetSize().cy / (float)m_startSize.cy;
	
	Ctrl* child = GetFirstChild();
	while(child != NULL)
	{
		String temp;
		temp << child->GetSize().cx << " | " << child->GetSize().cy;
		temp << " @ " << child->GetRect().TopLeft().x << " | " << child->GetRect().TopLeft().y;
		Title(temp);
		
		child->LeftPosZ(child->GetRect().TopLeft().x * sizeXChange, child->GetSize().cx * sizeXChange);
		child->TopPosZ(child->GetRect().TopLeft().y * sizeYChange, child->GetSize().cy * sizeYChange);
		
		child = child->GetNext();
	}
}

So like you can see there is sth wrong with the size/position gathering because it is sth completely different to the values I set in the layout file.

I will add the complete testprogram as well if you want to check it out.


Greetings
Daniel

[Updated on: Wed, 13 September 2017 15:50]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Add layouts/ParentCtrl to column list
Next Topic: How to blur a Ctrl
Goto Forum:
  


Current Time: Wed Apr 24 13:06:29 CEST 2024

Total time taken to generate the page: 0.01807 seconds