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 #275 is a reply to message #233] Mon, 05 December 2005 22:51 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
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....
 
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: Fri Nov 01 01:36:09 CET 2024

Total time taken to generate the page: 0.04647 seconds