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 #2117 is a reply to message #2115] Sat, 01 April 2006 19:56 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

One more question...

I'm working with the designer, then copy and past the code as Fudadmin pointed out. It seems easy. Now I have many labels. They are all passive and show some text. I would like to declare just one label widget like this:

Label label;

and the use 'label' everywhere (I used to do so with another GUI in C). So I believed that the following code:

	label.SetLabel(t_("Label 1"));
	label.SetAlign(ALIGN_CENTER);
	label.LeftPosZ(236, 48);
	label.TopPosZ(96, 19);
	Add(label);

	label.SetLabel(t_("Label 2"));
	label.SetAlign(ALIGN_CENTER);
	label.LeftPosZ(136, 48);
	label.TopPosZ(46, 49);
	Add(label);


could show two labels. Instead seems that 'Label 2' override the first one. So at the end I see only 1, the last.
This means that I have to use two separate variables (object):

Label label, label1;
	label.SetLabel(t_("Label 1"));
	label.SetAlign(ALIGN_CENTER);
	label.LeftPosZ(236, 48);
	label.TopPosZ(96, 19);
	Add(label);

	label1.SetLabel(t_("Label 2"));
	label1.SetAlign(ALIGN_CENTER);
	label1.LeftPosZ(136, 48);
	label1.TopPosZ(46, 49);
	Add(label1);


and both appear. I would like to know if there is some trick to use the same object or I must in any case declare each object I use.

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 16:39:02 CEST 2024

Total time taken to generate the page: 0.03092 seconds