Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl: how to identify embeded Option
Re: ArrayCtrl: how to identify embeded Option [message #60648 is a reply to message #60647] |
Thu, 20 June 2024 10:42  |
 |
forlano
Messages: 1215 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Here is the solution after the Victor's example
https:// www.ultimatepp.org/forums/index.php?t=msg&th=12293&g oto=60649&#msg_60649
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct Test : TopWindow {
ArrayCtrl ar;
void AddOption(int row, int col, int idOpt) {
Option& opt = ar.CreateCtrl<Option>(row,col,false);
opt << [&,idOpt] {
Exclamation(Sprintf("Pressed Option: ID = %d , status = %d", idOpt, opt.Get()));
};
}
Test() {
SetRect(0, 0, 640, 480);
Add(ar.SizePos());
ar.AddColumn("Col 1", 1);
ar.AddColumn("Col 2", 1);
ar.AddColumn("Col 3", 1);
for (int i=0; i<10; ++i) ar.Add(i);
AddOption(0, 1, 100);
AddOption(1, 2, 101);
AddOption(2, 1, 102);
AddOption(3, 2, 103);
AddOption(4, 1, 104);
AddOption(5, 2, 105);
AddOption(6, 1, 106);
AddOption(7, 2, 106);
}
};
GUI_APP_MAIN {
Test().Run();
}
[Updated on: Thu, 20 June 2024 13:20] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Aug 25 13:39:27 CEST 2025
Total time taken to generate the page: 0.00680 seconds
|