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 » Size of TopWindow is different then the size I set for it
Size of TopWindow is different then the size I set for it [message #48330] Fri, 23 June 2017 15:58 Go to previous message
rafiwui is currently offline  rafiwui
Messages: 105
Registered: June 2017
Location: Stuttgart, Germany
Experienced Member
When I wanted to add some buttons to a window I encountered a problem:
They were not fully visible. I added them depending on the size returned by TopWindow::GetSize() so I thought they should fit.
Can someone tell me why the TopWIndow is not in the size I gave him?

Here is an example code snippet that should produce the problem properly:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;

GUI_APP_MAIN
{
	TopWindow app;
	app.SetRect(0, 0, 500, 200);
	
	Button button1;
	// Button 1 should be centered and with a bit of space on both sides and a bit of space to
	// the top
	button1.SetLabel("Test Button 1").LeftPosZ(10, 480).TopPosZ(10, 80);
	
	Button button2;
	// Button 2 should be centered and with a bit of space on both sides and a bit of space to
	// the bottom. This time the size is measured from the size of the TopWindow and not
	// hardcoded
	button2.SetLabel("Test Button 2").LeftPosZ(10, app.GetSize().cx - 20).TopPosZ(110, 80);
	
	app.Add(button1);
	app.Add(button2);
	
	app.Run();
}


And to be safe I added an image how the window looks when you run the code.


Greetings
Daniel
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to blur a Ctrl
Next Topic: preferred way to get event "sender" control?
Goto Forum:
  


Current Time: Sun Apr 28 15:39:57 CEST 2024

Total time taken to generate the page: 0.07643 seconds