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 » add StatusBar fields [EXAMPLE]
Re: add StatusBar fields [message #280 is a reply to message #279] Mon, 05 December 2005 23:06 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14258
Registered: November 2005
Ultimate Member
I am really sorry, but I have misinformed you this time. You are right, I was wrong. You are really supposed to do this this way.

I have posted reference example I have just finished in another topic, anyway it will not hurt to repost it here, in snippets section:

#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();
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How do I add a StatusBar on my window
Next Topic: Statusbar disappears
Goto Forum:
  


Current Time: Tue May 13 20:34:04 CEST 2025

Total time taken to generate the page: 0.02959 seconds