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 » Buttons in Array using ArrayCtrl
Re: Buttons in Array using ArrayCtrl [message #37761 is a reply to message #37759] Sat, 10 November 2012 14:32 Go to previous messageGo to previous message
omari is currently offline  omari
Messages: 266
Registered: March 2010
Experienced Member
Hi,
you can use WidgetFactory callback:


.h


#define LAYOUTFILE <XXXXXX/XXX.lay>
#include <CtrlCore/lay.h>

struct test : WithXXX<TopWindow> {
	typedef test CLASSNAME;
	test();
	void WidgetFactory(int line, One<Ctrl>& x);
	void OnButton(int n);
};


.cpp
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#include "test.h"

void test::OnButton(int n)
{
	PromptOK(AsString(n));
}

void test::WidgetFactory(int line, One<Ctrl>& x)
{
	Button& b = x.Create<Button>();
	b.SetLabel("Line " + AsString(line));	
	b.LeftPos(10, 60).TopPos(4, 16);
	
	b <<= THISBACK1(OnButton, line);
}

test::test()
{	
	CtrlLayout(*this, "Window title");
	myArray.AddColumn("List of Tables").Ctrls(THISBACK(WidgetFactory));
	
	myArray.SetLineCy( 20);
	
	myArray.Add();
	myArray.Add();
	myArray.Add();
	myArray.Add();
	myArray.Add();
}

GUI_APP_MAIN
{
	test().Run();
}




Regards,
Omari


regards
omari.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Changing EditFields from header files
Next Topic: No Export to PDF button in Windows?
Goto Forum:
  


Current Time: Mon May 13 07:43:10 CEST 2024

Total time taken to generate the page: 0.02290 seconds