Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl: how to set label for embedded controls?
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: 14261 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
|
|
|
Goto Forum:
Current Time: Wed Jun 25 19:11:22 CEST 2025
Total time taken to generate the page: 0.04185 seconds
|