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 » Developing U++ » UppHub » Grid helper
Grid helper [message #30432] Thu, 30 December 2010 17:38 Go to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

In the past I ran quite a few times into situation where I needed to position several Ctrls into a rectangular grid. Doing this correctly (so that everything is scaled properly when resizing etc.) is a nightmare. So I decided to write a helper Ctrl called Grid (do not confuse with GridCtrl Smile ), which does all the dirty work.

The basic idea is that Grid gives you a x*y equidistant ParentCtrls, that are resized and positioned as necessary, so you don't have to care about that. Inside these ParentCtrls you can put any Ctrls you want (zero or more). The interesting parts of interface look like this:
	Grid();
	Grid(int x,int y);
	Grid& SetSize(int x,int y);
	Grid& SetXSize(int x);
	Grid& SetYSize(int y);
	Grid& SetColor(class Color color);
	Grid& ShowGrid(bool show=true);
	Grid& NoGrid()
	ParentCtrl& Get(int x,int y);

Instead of grid.Get(x,y), you can also use grid[x][y].

The attached archive includes the Grid class, .usc file and simple example app (see the screenshot in next post).

Best regards,
Honza

PS: I am aware that ArrayCtrl or GridCtrl could do the same job, but I believe that in many cases it would be overkill...
  • Attachment: Grid.zip
    (Size: 3.12KB, Downloaded 270 times)

[Updated on: Thu, 30 December 2010 17:42]

Report message to a moderator

Re: Grid helper [message #30433 is a reply to message #30432] Thu, 30 December 2010 17:39 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Screenshot of example app:
index.php?t=getfile&id=3010&private=0
  • Attachment: grid.png
    (Size: 16.29KB, Downloaded 451 times)
Previous Topic: More new functions
Next Topic: Excel
Goto Forum:
  


Current Time: Thu Mar 28 12:31:45 CET 2024

Total time taken to generate the page: 0.00900 seconds