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 » ArrayCtrl, HeaderCtrl & GridCtrl » Why SetCtrl() places controls in first row of ArrayCtrl?
Re: Why SetCtrl() places controls in first row of ArrayCtrl? [message #61757 is a reply to message #61756] Tue, 29 July 2025 10:04 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1223
Registered: August 2007
Senior Contributor
Hello lmonda,

Welcome to U++ forums!


Is there a specific reason why you use SetCtrl? The traditional way in U++ is as follows:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct MyApp : TopWindow {
	ArrayCtrl list;
	MyApp()
	{
		Sizeable().Zoomable().CenterScreen().SetRect(0, 0, 800, 600);
		Add(list.SizePos());
		list.AddColumn("Column1").Ctrls([this](int i, One<Ctrl>& ctrl) {
			ctrl.Create<Option>().SetLabel("Option " + AsString(i));
		});
	
		list.AddColumn("Column2").Ctrls([this](int i, One<Ctrl>& ctrl) {
			ctrl.Create<Button>().SetLabel("Button " + AsString(i));
		});

		for(int i = 0; i < 10; i++)
			list.Add();
	}
	
};

GUI_APP_MAIN
{
	MyApp().Run();
}



Note that this is more flexible and simple because:

1) You don't need to manage options separately. They are handled by the ArrayCtrl.
2) You can create any type of Ctrl per column AND row index.

Above code will result in this:

index.php?t=getfile&id=7103&private=0

I also suggest you play with the reference examples and read the API doc of ArrayCtrl. It is comprehensive.


Best regards,
Oblivion


[Updated on: Tue, 29 July 2025 11:16]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ArrayCtrl - GetCtrl() function question
Goto Forum:
  


Current Time: Tue Aug 12 02:27:15 CEST 2025

Total time taken to generate the page: 0.12318 seconds