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 » U++ Library support » StatusBar&InfoCtrl » howto add more InfoCtrl's to StatusBar?
Re: howto add more InfoCtrl's to StatusBar? [message #233 is a reply to message #232] Sun, 04 December 2005 23:07 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Quote:


I felt that... but I haven't been successful. What would be the correct way then?


#include <CtrlLib/CtrlLib.h>

class MyClassWindow : public TopWindow {
private:
	StatusBar  status1; //edited: was MyStatusBar
        InfoCtrl  info2;	

public:
	typedef MyClassWindow CLASSNAME;
	MyClassWindow();
};


MyClassWindow::MyClassWindow()
{
	status1.AddFrame(info2.Width(250));
	info2="info2: Welcome to the Ultimate++ !";
	AddFrame(status1.Height(25));

}

	
GUI_APP_MAIN
{
 	MyClassWindow().Title("MyClassWindow1").Zoomable().Sizeable().Run();
 	MyClassWindow().SetRect(0, 0, 260, 80);
}


Note once again that this is basically the wrong code - I am just demonstrating that in similar situation, creating separate class is not necessarry - and not creating it is better, as you will have to access that "info2" from MyClassWindow anyway.

The lesson to learn is that in U++, class composition does not have to follow GUI hierarchy. It is not uncommon to e.g. have TopWindow as member variable and put "self" into it:

struct Foo : Button {
   TopWindow win;

   void Perform() { win.Run(); }

   Foo() {
      win.Add(SizePos());
   }
};



[Updated on: Mon, 05 December 2005 11:09] by Moderator

Report message to a moderator

 
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: Statusbar disappears
Next Topic: Using SizeGrip on StatusBar locks mouse on Kubuntu Linux
Goto Forum:
  


Current Time: Thu May 16 06:40:33 CEST 2024

Total time taken to generate the page: 0.02776 seconds