Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » How to combine two widget-class in the topwindow
Re: How to combine two widget-class in the topwindow [message #2130 is a reply to message #2120] Sun, 02 April 2006 10:22 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
fudadmin wrote on Sat, 01 April 2006 20:27


Label is a class (dead description, recipe, mold, pattern set of genes, etc.).
label1, label2 etc. are class instances (real live objects like someone's children).

By declareing:
Label label1, label2;
you instanciate them or make the very begining of life.

Then you shape them.
label1 - red hair, big ears...
label2 - yellow hair, small head...
etc...

Can you imagine the same child beeing a daughter and a son, having all green and red hair at the same time? Smile



Yes, I agree it's not confortable for the child... and maybe for the parents too Razz .
Here is my new achievement. I used your method of copy and past from designer after CTRL+T. About Designer I will report later in the appropriate place of the forum. Below is the code I have modified being all the rest of the program remained the same.

//personalized tab (1 child) widget
class LuigiTab : public ParentCtrl {
	Button btnAdd, btnDel, btnClear, btnModify;
	DocEdit doc;
	LabelBox lbox;
	Label label[10];
	EditString editName, editCountry, editBirth, editNatRat,
	           editNatId, editFIDEId, editFIDERat;
	DropList editTitle;
	Option tsex;
	EditInt kcoeff;
	ArrayCtrl arr;
	
public:

	typedef LuigiTab CLASSNAME;
	LuigiTab();
	~LuigiTab(){;}
};

LuigiTab::LuigiTab() {
		
	// label
	lbox.SetLabel(t_("Edit Player")).LeftPosZ(16, 648).TopPosZ(16, 80);
	Add(lbox);
	
	label[0].SetLabel(t_("Name")).SetAlign(ALIGN_CENTER).LeftPosZ(28, 132).TopPosZ(32, 19);
	Add(label[0]);
	
	label[1].SetLabel(t_("Fed")).SetAlign(ALIGN_CENTER).LeftPosZ(168, 40).TopPosZ(32, 19);
	Add(label[1]);
	
	label[2].SetLabel(t_("Birthday")).SetAlign(ALIGN_CENTER).LeftPosZ(208, 56).TopPosZ(32, 19);
	Add(label[2]);
	
	label[3].SetLabel(t_("Gender")).SetAlign(ALIGN_CENTER).LeftPosZ(264, 56).TopPosZ(32, 19);
	Add(label[3]);
	
	label[4].SetLabel(t_("Title")).SetAlign(ALIGN_CENTER).LeftPosZ(324, 40).TopPosZ(32, 19);
	Add(label[4]);
	
	label[5].SetLabel(t_("ID FIDE")).SetAlign(ALIGN_CENTER).LeftPosZ(380, 48).TopPosZ(32, 19);
	Add(label[5]);
	
	label[6].SetLabel(t_("Rat FIDE")).SetAlign(ALIGN_CENTER).LeftPosZ(440, 48).TopPosZ(32, 19);
	Add(label[6]);
	
	label[7].SetLabel(t_("ID Nat")).SetAlign(ALIGN_CENTER).LeftPosZ(496, 48).TopPosZ(32, 19);
	Add(label[7]);
	
	label[8].SetLabel(t_("Rat Nat")).SetAlign(ALIGN_CENTER).LeftPosZ(558, 48).TopPosZ(32, 19);
	Add(label[8]);
	
	label[9].SetLabel(t_("K")).SetAlign(ALIGN_CENTER).LeftPosZ(616, 24).TopPosZ(32, 19);
	Add(label[9]);
	
	//active widget
	editName.MaxLen(25).LeftPosZ(28, 136).TopPosZ(56, 19);
	Add(editName);
	
	editCountry.MaxLen(3).LeftPosZ(172, 32).TopPosZ(56, 19);
	Add(editCountry);

	editNatId.MaxLen(8).LeftPosZ(496, 48).TopPosZ(56, 19);
	Add(editNatId);

	editBirth.MaxLen(10).LeftPosZ(212, 56).TopPosZ(56, 19);
	Add(editBirth);
	
	editFIDERat.MaxLen(8).LeftPosZ(440, 48).TopPosZ(56, 19);
	Add(editFIDERat);
	
	tsex.SetLabel(t_("Male")).LeftPosZ(280, 42).TopPosZ(56, 20);
	Add(tsex);
	
	editTitle.DisplayAll(true).LeftPosZ(328, 42).TopPosZ(56, 20);
	Add(editTitle);
	
	editFIDEId.MaxLen(8).LeftPosZ(380, 48).TopPosZ(56, 19);
	Add(editFIDEId);

	editNatRat.MaxLen(8).LeftPosZ(554, 56).TopPosZ(56, 19);
	Add(editNatRat);
		
	kcoeff.Min(0).Max(100).LeftPosZ(620, 24).TopPosZ(56, 19);
	Add(kcoeff);
	
    // button
	btnAdd.SetLabel(t_("Add Player")).LeftPosZ(24, 96).TopPosZ(116, 24);
	Add(btnAdd);

	btnModify.SetLabel(t_("Modify Player")).LeftPosZ(148, 96).TopPosZ(116, 24);
	Add(btnModify);
		
	btnDel.SetLabel(t_("Delete Player")).LeftPosZ(56, 96).TopPosZ(328, 24);
	Add(btnDel);
	
	btnClear.SetLabel(t_("Clear Data")).LeftPosZ(284, 96).TopPosZ(116, 24);
	Add(btnClear);
	
	// array ctrl
	arr.Moving(true).Removing(true).AppendLine(true).Inserting(true).LeftPosZ(16, 648).TopPosZ(172, 148);
	Add(arr);
		
	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");


At the moment this class is instancied in each tab while I want it stays only in tab 1. I believe I must realize a different class for each tab like:
class LuigiTab1 : public ParentCtrl // tab 1
class LuigiTab2 : public ParentCtrl // tab 2
class LuigiTab3 : public ParentCtrl // tab 3

and then create an instance for each of them.

I need to add data to the drop list button. Unfortunatly I have no example in the documentation and I do not know how to do.

In the coloumn available of the arrayctrl I would like to have a chekbox (checked means available, and unchecked unavailable). Any suggestion?

In the addressbook package there is an example similar to what I want to do: simply fill the fields and then push the data in then arrayctrl. This is my next task.

The geometry of the whole tab is not perfect but now it is important to learn how to dispatch the data between the object and how to retrieve them. The beauty can wait.
Thank you,

Luigi
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mouse over button example -"catch me if you can..."
Next Topic: "Forlano tabs" - how to reduce a headache by the proper use of the designer...
Goto Forum:
  


Current Time: Mon May 13 10:36:18 CEST 2024

Total time taken to generate the page: 0.02238 seconds