Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » "Forlano tabs" - fill EditFields from ArrayCtrl Row...
"Forlano tabs" - fill EditFields from ArrayCtrl Row... [message #2212] |
Tue, 04 April 2006 04:51 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
If you had asked this way you would have got it faster...
class Tab1 : public WithTab1Layout<TopWindow> {
public:
typedef Tab1 CLASSNAME;
Tab1();
void AddPlayer(); //callback from Add_Player button
void MaskDefaultValue(); //callback from Clera button
void FillFieldsFromRow();
};
void Tab1::FillFieldsFromRow(){
int int_row=arr.GetCursor();
editName <<= arr.Get(int_row, "Name"); //0
editCountry <<= arr.Get(int_row, "Country"); //1
editBirth <<= arr.Get(int_row, "Birthday"); //2
tsex <<= arr.Get(int_row, "Gender"); //3
editTitle <<= arr.Get(int_row, "Title"); //4
editFIDEId <<= arr.Get(int_row, "IDFIDE"); //5
editFIDERat <<= arr.Get(int_row, "RatFIDE"); //6
editNatId <<= arr.Get(int_row, "IDNat"); //7
editNatRat <<= arr.Get(int_row, "RatNat"); //8
kcoeff <<= arr.Get(int_row, "K"); //9
optAvail <<= arr.Get(int_row, "Avail"); //10 "Avail" doesn't work? ArrayCtrl.cpp line 198 assertion failed
//Edit: a comma was missing in constructor...
}
Tab1::Tab1()
{
CtrlLayout(*this, "");
//id, label, width
arr.AddColumn("Name", "Name", 10); //0
arr.AddColumn("Country", "Fed", 3); //1
arr.AddColumn("Birthday", "Birthday", 4); //2
arr.AddColumn("Gender", "Gender", 4); //3
arr.AddColumn("Title", "Title", 4); //4
arr.AddColumn("IDFIDE", "ID FIDE", 4); //5
arr.AddColumn("RatFIDE", "Rat FIDE", 4); //6
arr.AddColumn("IDNat", "ID Nat", 4); //7
arr.AddColumn("RatNat", "Rat Nat", 4); //8
arr.AddColumn("K", "K", 3); //9
arr.AddColumn("Avail", "Avail?", 3).Ctrls<Option>(); //10
// how to set ON the checkbox?
optAvail.Set(1);
editName.MaxLen(6); //you can enter 26
//drop list widget
editTitle.Add(1, "First");
editTitle.Add(2, "Second");
editTitle.Add(3, "Third");
//set the callback for the Add_Player button
btnAdd <<= THISBACK(AddPlayer);
btnClear <<= THISBACK(MaskDefaultValue);
//to retrieve the row?
arr.WhenLeftClick = THISBACK(FillFieldsFromRow);
//fill with default value
MaskDefaultValue();
}
[Updated on: Wed, 05 April 2006 14:35] Report message to a moderator
|
|
|
Re: "Forlano tabs" - fill EditFields from ArrayCtrl Row... [message #2218 is a reply to message #2212] |
Tue, 04 April 2006 10:56 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
fudadmin wrote on Tue, 04 April 2006 04:51 | If you had asked this way you would have got it faster...
class Tab1 : public WithTab1Layout<TopWindow> {
public:
typedef Tab1 CLASSNAME;
Tab1();
void AddPlayer(); //callback from Add_Player button
void MaskDefaultValue(); //callback from Clera button
void FillFieldsFromRow();
};
void Tab1::FillFieldsFromRow(){
int int_row=arr.GetCursor();
editName <<= arr.Get(int_row, "Name"); //0
editCountry <<= arr.Get(int_row, "Country"); //1
editBirth <<= arr.Get(int_row, "Birthday"); //2
tsex <<= arr.Get(int_row, "Gender"); //3
editTitle <<= arr.Get(int_row, "Title"); //4
editFIDEId <<= arr.Get(int_row, "IDFIDE"); //5
editFIDERat <<= arr.Get(int_row, "RatFIDE"); //6
editNatId <<= arr.Get(int_row, "IDNat"); //7
editNatRat <<= arr.Get(int_row, "RatNat"); //8
kcoeff <<= arr.Get(int_row, "K"); //9
optAvail <<= arr.Get(int_row, 10); //10 "Avail" doesn't work? ArrayCtrl.cpp line 198 assertion failed
}
Tab1::Tab1()
{
CtrlLayout(*this, "");
//id, label, width
arr.AddColumn("Name", "Name", 10); //0
arr.AddColumn("Country", "Fed", 3); //1
arr.AddColumn("Birthday", "Birthday", 4); //2
arr.AddColumn("Gender", "Gender", 4); //3
arr.AddColumn("Title", "Title", 4); //4
arr.AddColumn("IDFIDE", "ID FIDE", 4); //5
arr.AddColumn("RatFIDE", "Rat FIDE", 4); //6
arr.AddColumn("IDNat", "ID Nat", 4); //7
arr.AddColumn("RatNat", "Rat Nat", 4); //8
arr.AddColumn("K", "K", 3); //9
arr.AddColumn("Avail" "Avail?", 3).Ctrls<Option>(); //10
// how to set ON the checkbox?
optAvail.Set(1);
editName.MaxLen(6); //you can enter 26
//drop list widget
editTitle.Add(1, "First");
editTitle.Add(2, "Second");
editTitle.Add(3, "Third");
//set the callback for the Add_Player button
btnAdd <<= THISBACK(AddPlayer);
btnClear <<= THISBACK(MaskDefaultValue);
//to retrieve the row?
arr.WhenLeftClick = THISBACK(FillFieldsFromRow);
//fill with default value
MaskDefaultValue();
}
|
Very nice code.
... and of course varying int_row over all the row in a loop I get all the data of the array. It is amazing simply!
Luigi
[Updated on: Wed, 05 April 2006 13:01] by Moderator Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Sat May 04 16:58:30 CEST 2024
Total time taken to generate the page: 0.02497 seconds
|