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 #12940 is a reply to message #275] Thu, 29 November 2007 15:29 Go to previous messageGo to previous message
digodigo is currently offline  digodigo
Messages: 4
Registered: November 2007
Junior Member

luzr wrote on Mon, 05 December 2005 22:51

I have to apologize... this time you understood my code better than me Smile "Set" is further level of division, you are really supposed to use AddFrame to add more "fields".

I have created this nice reference example to demonstrate StatusBar:

#include <CtrlLib/CtrlLib.h>

struct PosDisplay : Display {
	Color color;

	virtual void Paint(Draw& w, const Rect& r, const Value& q,
	                   Color ink, Color paper, dword style) const {
		int i = q;
		w.DrawRect(0, 0, i, r.Height(), color);
		w.DrawRect(i, 0, r.Width() - i, r.Height(), SWhite);
	}
};

struct App : TopWindow {
	StatusBar   status;
	InfoCtrl    pos;
	InfoCtrl    x, y;
	PosDisplay  dx, dy;

	virtual void MouseMove(Point p, dword)
	{
		pos.Set(0, AsString(p.x), 40);
		pos.Set(1, AsString(p.y), 40);
		x.Set(PaintRect(dx, 100 * p.x / GetSize().cx));
		y.Set(PaintRect(dy, 100 * p.y / GetSize().cy));
	}
	
	virtual void LeftDown(Point, dword)
	{
		status.Temporary("Left mouse button pressed!");
	}
	
	App() {
		Sizeable();
		SetFrame(FieldFrame());
		AddFrame(status);
		status.AddFrame(pos.Right(100));
		status.AddFrame(x.Left(100));
		status.AddFrame(y.Left(100));
		dx.color = LtRed;
		dy.color = LtGreen;
	}
};

GUI_APP_MAIN
{
	App().Run();
}


Once again, sorry for misinformation, last time I visited StatusBar was two years ago and never used it above simple assigning text to it....




THANKS CHAMPZ !!!
it's did help me too !!!
 
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: Mon Apr 29 17:04:35 CEST 2024

Total time taken to generate the page: 0.03072 seconds