Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » "Forlano tabs" - how to reduce a headache by the proper use of the designer...
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2176 is a reply to message #2173] |
Mon, 03 April 2006 00:17 |
|
forlano
Messages: 1202 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
luzr wrote on Sun, 02 April 2006 20:54 |
forlano wrote on Sun, 02 April 2006 14:46 |
I've no idea about how to fill the drop list, and how to add a checkbox inside the arrayctrl. [snip]
|
DropList dl;
ArrayCtrl ar;
....
dl.Add(1, "First item");
dl.Add("Second", "Second item");
ar.AddColumn("Check").Ctrls<Option>();
Mirek
|
Thank you Mirek,
I've not resisted to the temptetion to write the code before to go to sleep... even because I was afraid that Fudadmin (by the way... which is your human name?) could anticipate me once more . With my surprise I was able to perform everything in not more than 10 minutes! (two day ago I wont bet a cent). Here is the new class Tab1 code with Add and Clear button activated:
class Tab1 : public WithTab1Layout<TopWindow> {
public:
typedef Tab1 CLASSNAME;
Tab1();
void AddPlayer(); //callback from Add_Player button
void MaskDefaultValue(); //callback from Clera button
};
Tab1::Tab1()
{
CtrlLayout(*this, "");
arr.AddColumn("Name");
arr.AddColumn("Fed");
arr.AddColumn("Birthday");
arr.AddColumn("Gender");
arr.AddColumn("Title");
arr.AddColumn("ID FIDE");
arr.AddColumn("Rat FIDE");
arr.AddColumn("ID Nat");
arr.AddColumn("Rat Nat");
arr.AddColumn("K");
arr.AddColumn("Available").Ctrls<Option>();
// how to set ON the checkbox?
//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);
//fill with default value
MaskDefaultValue();
}
void Tab1::AddPlayer() // body of the callback
{
if ( (~editName) == Null) {
PromptOK("The Name field cannot be empty!");
return;
}
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff);
arr.GoEnd();
// editName <<= editCountry <<= editBirth <<= tsex <<= editTitle <<= editFIDEId <<=
// editFIDERat <<= editNatId <<= editNatRat <<=kcoeff <<= Null;
ActiveFocus(editName);
MaskDefaultValue();
}
void Tab1::MaskDefaultValue() // body of the callback
{
editName <<= Null;
editCountry <<= "--";
editBirth <<= "00.00.00";
tsex <<= 1;
editTitle <<= "GM";
editFIDEId <<= editFIDERat <<= editNatId <<= editNatRat <<= 0;
kcoeff <<= 30;
ActiveFocus(editName);
}
Now arise some questions that regards the details (the details make the difference as everybody knows):
1. I desire my user do not enter more than 25 character in the editName widget. It is not enough that a pink colour appear. I desire that the widget refuse to write any character further the 25th. Is there such limitation?
2. I desire that the lenght of the arrayCtrl in corrispondence, for example, of field Name be 25 character long. The user can tune it manually but I prefer to set it initially to some lenght. How to do it?
3. The check box appear in the array but it is not set to ON (checked) but it is unchecked. How to set it to ON?
4. I desire that the even numbered line of the array be colored, say light blue (I love this feature. By the way, in the past this feature attracted my attention toward Ultimate++)
Now I can go to sleep very . Today was a great day!
The next step is to click on the array, retrieve the data of the row, and sent them in the above mask for some modification.
Good night,
Luigi
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2177 is a reply to message #2176] |
Mon, 03 April 2006 13:23 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
Quote: | 3. The check box appear in the array but it is not set to ON (checked) but it is unchecked. How to set it to ON?
|
The simpliest solution is this:
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, 1);
//1 - for option
[Updated on: Mon, 03 April 2006 13:23] Report message to a moderator
|
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2179 is a reply to message #2177] |
Mon, 03 April 2006 13:29 |
|
forlano
Messages: 1202 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
fudadmin wrote on Mon, 03 April 2006 13:23 |
Quote: | 3. The check box appear in the array but it is not set to ON (checked) but it is unchecked. How to set it to ON?
|
The simpliest solution is this:
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, 1);
//1 - for option
|
Very nice solution! (The simplest is always the better)
Now remain 1 more question
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2180 is a reply to message #2178] |
Mon, 03 April 2006 13:32 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
Regarding 3. option...
...or 3.1 add to your *.lay
ITEM(Label, dv___1, SetLabel(t_("Avail?")).SetAlign(ALIGN_CENTER).LeftPosZ(652, 32).TopPosZ(32, 19))
ITEM(Option, optAvail, LeftPosZ(660, 16).TopPosZ(56, 19))
3.2 initialize
arr.AddColumn("Available").Ctrls<Option>();
// how to set ON the checkbox?
optAvail.Set(1);
3.3 don't forget to add to the array:
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, ~optAvail);
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2181 is a reply to message #2178] |
Mon, 03 April 2006 13:45 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
Regarding column widths- I would prefer to see what width is set for which column:
arr.AddColumn("Name",10);
arr.AddColumn("Fed",3);
arr.AddColumn("Birthday",4);
arr.AddColumn("Gender",4);
arr.AddColumn("Title",4);
arr.AddColumn("ID FIDE",4);
arr.AddColumn("Rat FIDE",4);
arr.AddColumn("ID Nat",4);
arr.AddColumn("Rat Nat",4);
arr.AddColumn("K",3);
arr.AddColumn("Available",3).Ctrls<Option>();
or even calculated from edit field layouts or from column text lengths or something combined...
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2184 is a reply to message #2177] |
Mon, 03 April 2006 16:33 |
|
mirek
Messages: 14105 Registered: November 2005
|
Ultimate Member |
|
|
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, 1);
//1 - for option
BTW, you can use "true" for clarity.. (bool is Value compatible, and inside Value, int64, int, double and bool are all inter-convertible).
Mirek
[Updated on: Mon, 03 April 2006 16:34] Report message to a moderator
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2185 is a reply to message #2184] |
Mon, 03 April 2006 16:37 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Mon, 03 April 2006 15:33 |
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, 1);
//1 - for option
BTW, you can use "true" for clarity.. (bool is Value compatible, and inside Value, int64, int, double and bool are all inter-convertible).
Mirek
|
"true" is 4 times more to type!!!
|
|
|
|
Re: "Forlano tabs" - how to reduce a headache by the proper use of the designer... [message #2188 is a reply to message #2185] |
Mon, 03 April 2006 16:39 |
|
mirek
Messages: 14105 Registered: November 2005
|
Ultimate Member |
|
|
fudadmin wrote on Mon, 03 April 2006 10:37 |
luzr wrote on Mon, 03 April 2006 15:33 |
arr.Add(~editName, ~editCountry, ~editBirth, ~tsex, ~editTitle,
~editFIDEId, ~editFIDERat, ~editNatId, ~editNatRat, ~kcoeff, 1);
//1 - for option
BTW, you can use "true" for clarity.. (bool is Value compatible, and inside Value, int64, int, double and bool are all inter-convertible).
Mirek
|
"true" is 4 times more to type!!!
|
"can" != "must"
Mirek
|
|
|
Goto Forum:
Current Time: Fri Nov 01 01:09:52 CET 2024
Total time taken to generate the page: 0.03900 seconds
|