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 |
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 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Well, there is the obvious way
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 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
mrjt wrote on Fri, 01 February 2008 11:42 | Well, there is the obvious way
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 |
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!
|
|
|
Goto Forum:
Current Time: Wed May 15 04:07:24 CEST 2024
Total time taken to generate the page: 0.02218 seconds
|