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 » ArrayCtrl: how to set label for embedded controls?
ArrayCtrl: how to set label for embedded controls? [message #13915] Fri, 01 February 2008 17:09 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

I`ve got simple case of using ArrayCtrl as list of check-values:
arrayCtrl.AddColumn().Ctrls<Option>();
arrayCtrl.Add(true);
arrayCtrl.Add(true);
arrayCtrl.Add(false);

I`ve got a column of checkboxes with no labels. Please tell how to set these labels for each control individually.
Manual didn`t help me with understanding.

[Updated on: Fri, 01 February 2008 17:09]

Report message to a moderator

Re: ArrayCtrl: how to set label for embedded controls? [message #13916 is a reply to message #13915] Fri, 01 February 2008 17:42 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Well, there is the obvious way Smile
arrayCtrl.AddColumn();
arrayCtrl.AddColumn().Ctrls<Option>();
arrayCtrl.Add("Option 1", true);
arrayCtrl.Add("Option 2", true);
arrayCtrl.Add("Option 3", false);


But if you want ot make things difficult for yourself:
// Members
ArrayCtrl array;
Array<Option> options;

...
array.AddColumn("Options");
array.Add(true);
array.Add(true);
array.Add(false);

array.SetCtrl(0, 0, options.Create<Option>().SetLabel("Option 1"), true);
array.SetCtrl(1, 0, options.Create<Option>().SetLabel("Option 2"), true);
array.SetCtrl(2, 0, options.Create<Option>().SetLabel("Option 3"), true);

I believe there are also others (you could use a factory for instance).

[Updated on: Fri, 01 February 2008 17:44]

Report message to a moderator

Re: ArrayCtrl: how to set label for embedded controls? [message #13930 is a reply to message #13916] Fri, 01 February 2008 22:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Fri, 01 February 2008 11:42

Well, there is the obvious way Smile
arrayCtrl.AddColumn();
arrayCtrl.AddColumn().Ctrls<Option>();
arrayCtrl.Add("Option 1", true);
arrayCtrl.Add("Option 2", true);
arrayCtrl.Add("Option 3", false);


But if you want ot make things difficult for yourself:
// Members
ArrayCtrl array;
Array<Option> options;

...
array.AddColumn("Options");
array.Add(true);
array.Add(true);
array.Add(false);

array.SetCtrl(0, 0, options.Create<Option>().SetLabel("Option 1"), true);
array.SetCtrl(1, 0, options.Create<Option>().SetLabel("Option 2"), true);
array.SetCtrl(2, 0, options.Create<Option>().SetLabel("Option 3"), true);

I believe there are also others (you could use a factory for instance).


NOTE: You do not need Create here, because you are not creating derived type.

array.SetCtrl(0, 0, options.Add().SetLabel("Option 1"), true);
array.SetCtrl(1, 0, options.Add().SetLabel("Option 2"), true);
array.SetCtrl(2, 0, options.Add().SetLabel("Option 3"), true);


should work too.

Mirek
Re: ArrayCtrl: how to set label for embedded controls? [message #13972 is a reply to message #13930] Mon, 04 February 2008 10:02 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

luzr wrote on Sat, 02 February 2008 00:39

array.SetCtrl(0, 0, options.Add().SetLabel("Option 1"), true);
array.SetCtrl(1, 0, options.Add().SetLabel("Option 2"), true);
array.SetCtrl(2, 0, options.Add().SetLabel("Option 3"), true);


should work too.

Mirek


Thanx, that really helped!
Previous Topic: EditDouble causes crash in GridCtrl
Next Topic: ArrayCtrl with ProgressIndicator [SOLVED]
Goto Forum:
  


Current Time: Fri Apr 26 17:32:48 CEST 2024

Total time taken to generate the page: 0.02890 seconds