Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » how to set/get data in a composite embedded ctrl in an arrayctrl
how to set/get data in a composite embedded ctrl in an arrayctrl [message #3076] |
Sat, 06 May 2006 02:06 |
|
forlano
Messages: 1189 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
here is a new variant of a code already posted in this forum. We have an arrayctrl with two column of which the second one contains a composite embedded ctrl (editint+label). The click on the button start the scan of the rows to get their value.
I would like to get some hint for the followomg tasks:
1. how to GET the data of editint in row 'i' ;
2. how to SET the data of editint in row 'i' ;
I am able to perform this task in case of a single control in the cell but with two in the cell I'm lost .
Thank you
Luigi
#include <CtrlLib/CtrlLib.h>
#define LAYOUTFILE <edithelp/a.lay>
#include <CtrlCore/lay.h>
//--------------------- begin class -----------------
class EditLabel : public WithEditLabel<TopWindow> {
public:
typedef EditLabel CLASSNAME;
void WriteLabel();
EditLabel();
};
void EditLabel::WriteLabel()
{ lbl.SetLabel( AsString(~edit) );
SetFocus();
}
EditLabel::EditLabel()
{ CtrlLayout(*this, "");
edit <<= THISBACK(WriteLabel);
}
void Extra2(One<Ctrl>& ctrl)
{ ctrl.Create<EditLabel>();
}
//--------------------- end class -------------------
ArrayCtrl arr;
void getvaluearray()
{ for(int i=0; i<arr.GetCount(); i++)
{ Exclamation( AsString ( arr.Get(i, 0) ) ); // get data in column 0
// how to get the editint value in column 1?
}
}
GUI_APP_MAIN
{
TopWindow w;
Button btn;
arr.AddColumn("col1",20);
arr.AddColumn("col2",20).Ctrls(Extra2);
arr.SetLineCy(20);
arr.Add("aaa");
arr.Add("bbb");
arr.Add("ccc");
arr.SizePos();
w.Add(arr);
w.Add(btn);
btn.SetLabel("Get data").LeftPosZ(72, 116).TopPosZ(292, 20);
btn.WhenAction = callback(getvaluearray);
w.Run();
}
LAYOUT(EditLabel, 96, 19)
ITEM(EditInt, edit, LeftPosZ(2, 32).TopPosZ(1, 17))
ITEM(Label, lbl, SetFrame(ThinInsetFrame()).LeftPosZ(36, 60).TopPosZ(1, 17))
END_LAYOUT
[Updated on: Sat, 06 May 2006 02:06] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Jun 10 13:12:02 CEST 2024
Total time taken to generate the page: 0.02262 seconds
|