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 » Getting the width of a layout?
Re: Getting the width of a layout? [message #47797 is a reply to message #47785] Wed, 29 March 2017 09:33 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
When you see:
WithButtonLayout<ParentCtrl> buttonPanel;

Read instead:
ParentCtrl buttonPanel;

ParentCtrl is still the class of buttonPanel. Adding WithButtonLayout does not change the base class of your item. All it does is add a new set of fields and the CtrlLayout method so that you can apply the layout you designed to it.

So you can use the standard methods to get position and sizes.

The online documentation here is kind of lacking:
http://www.ultimatepp.org/srcdoc$CtrlCore$LogPos$en-us.html

But you can read the documentation for these functions from Ctrl:
	Ctrl&       LeftPos(int a, int size = STDSIZE);
	Ctrl&       RightPos(int a, int size = STDSIZE);
	Ctrl&       TopPos(int a, int size = STDSIZE);
	Ctrl&       BottomPos(int a, int size = STDSIZE);
	Ctrl&       HSizePos(int a = 0, int b = 0);
	Ctrl&       VSizePos(int a = 0, int b = 0);
	Ctrl&       SizePos();
	Ctrl&       HCenterPos(int size = STDSIZE, int delta = 0);
	Ctrl&       VCenterPos(int size = STDSIZE, int delta = 0);

	Ctrl&       LeftPosZ(int a, int size = STDSIZE);
	Ctrl&       RightPosZ(int a, int size = STDSIZE);
	Ctrl&       TopPosZ(int a, int size = STDSIZE);
	Ctrl&       BottomPosZ(int a, int size = STDSIZE);
	Ctrl&       HSizePosZ(int a = 0, int b = 0);
	Ctrl&       VSizePosZ(int a = 0, int b = 0);
	Ctrl&       HCenterPosZ(int size = STDSIZE, int delta = 0);
	Ctrl&       VCenterPosZ(int size = STDSIZE, int delta = 0);

	Rect        GetRect() const;
	Rect        GetScreenRect() const;

	Rect        GetView() const;
	Rect        GetScreenView() const;
	Size        GetSize() const;



So GetRect should allow you to determine the size of your layout.

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Example Serial pak
Next Topic: OpenGL demo resulting in Fatal error, Heap leaks detected! error...
Goto Forum:
  


Current Time: Fri Apr 26 01:14:16 CEST 2024

Total time taken to generate the page: 0.04650 seconds