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]
add StatusBar fields [EXAMPLE] [message #255] Mon, 05 December 2005 13:34 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
/*
demo - add StatusBar fields -version 1
not very correct according to luzr...
*/
#include <CtrlLib/CtrlLib.h>

class MyClassWindow : public TopWindow {
private:
	Label	label1;	
	StatusBar	status1;
	InfoCtrl	info2;
public:
	typedef MyClassWindow CLASSNAME;
	MyClassWindow();
};


MyClassWindow::MyClassWindow()
{
	//label stuff
	//Note: can't use AddFrame here, use:
	Add(label1.VCenterPos().HCenterPos(350));
	//questions: 350 is width -howto make auto?, what VCenter param does?
	label1.SetLabel("demo\n - add StatusBarFields -\nnot very correct according to luzr...");

	//status stuff
	status1.AddFrame(info2.Width(250));
	AddFrame(status1.Height(25));
	info2="info2: Welcome to the Ultimate++ !";	
}

	
GUI_APP_MAIN
{
 	MyClassWindow().Title("StatusBarFields -v1").Zoomable().Sizeable().Run();
}

[Updated on: Mon, 01 May 2006 10:28]

Report message to a moderator

Re: add StatusBar fields [message #265 is a reply to message #255] Mon, 05 December 2005 15:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13639
Registered: November 2005
Ultimate Member
Actually, the wrong thing there is that you are not using StatusBar there Smile

You could replace it with "framed" (FrameBottom) StaticRect (primitive widget that does nothing more than paints itself with defined color) and it would work too.
Re: add StatusBar fields [message #268 is a reply to message #265] Mon, 05 December 2005 15:21 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Mon, 05 December 2005 09:01

Actually, the wrong thing there is that you are not using StatusBar there Smile

You could replace it with "framed" (FrameBottom) StaticRect (primitive widget that does nothing more than paints itself with defined color) and it would work too.


As you can see, I want to catch the U++ logic... But not very succesfully... Could you just write the correct version Smile
Re: add StatusBar fields [message #279 is a reply to message #265] Mon, 05 December 2005 22:56 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Mon, 05 December 2005 09:01

Actually, the wrong thing there is that you are not using StatusBar there Smile



What do you mean by this?
I know that I didn't set the text value for it in this example.

But I want to have e.g an array of controls (e.g. labels with borders etc.) inside StatusBar control and display variuos values. I know I can achieve that different ways.
I just wanted to know capabilities of StatusBar and U++...
I searched in all u++ files and I didn't find any cases where it is used like that.
If StatusBar in U++ at this stage of development can have only 1 text field "natively" like "Ready" and 1 option to overwrite it, then say so...
Re: add StatusBar fields [message #280 is a reply to message #279] Mon, 05 December 2005 23:06 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13639
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();
}
Re: add StatusBar fields [message #291 is a reply to message #280] Wed, 07 December 2005 12:34 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Mon, 05 December 2005 17:06

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:




Thank you, Myrek, for 2 things:
1) the titanic job you've been doing with U++,
2) dignity to acknowledge your mistakes.

I'm not questioning the power of U++. I would call that "titanic power" - light yet very strong. Also, I want to find and show for other users the hidden parts of the iceberg to compensate the lack of documantation and features.

Re: add StatusBar fields [message #1901 is a reply to message #291] Sat, 25 March 2006 22:37 Go to previous messageGo to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
hallo boys Smile
i just want to say that this section of forum is very very needed !!!
so plesase put here moooore examples like that - it's realy very useful

and this:

I want to find and show for other users the hidden parts of the iceberg to compensate the lack of documantation and features.


is realy good and very true idea (i thing abaut the underwater part of iceberg Wink )
contiue it !!!
Bartek

[Updated on: Sat, 25 March 2006 22:40]

Report message to a moderator

Re: add StatusBar fields [message #1902 is a reply to message #1901] Sat, 25 March 2006 23:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13639
Registered: November 2005
Ultimate Member
barpas wrote on Sat, 25 March 2006 16:37

hallo boys Smile
i just want to say that this section of forum is very very needed !!!
so plesase put here moooore examples like that - it's realy very useful

and this:

I want to find and show for other users the hidden parts of the iceberg to compensate the lack of documantation and features.


is realy good and very true idea (i thing abaut the underwater part of iceberg Wink )
contiue it !!!
Bartek


The "result" of this discussion is now reference/StatusBar.

Really, to learn U++, go through reference examples. That is the simplest way....

Mirek
Re: add StatusBar fields [message #1903 is a reply to message #1902] Sun, 26 March 2006 00:09 Go to previous messageGo to next message
barpas is currently offline  barpas
Messages: 13
Registered: March 2006
Location: Poland
Promising Member
of course You are right i know this, if i dont know how to use somethig (eg widgets) i search this catalog by words inside files ...

You shoud add (and you adding) new examples to the reference katalog... but You can't put there all examples Wink

i remember there are a few experienced UPP users (eg. fudadmin, Daniel and others) i only ask them to put there their own examples ...

don't be angry Wink

[Updated on: Sun, 26 March 2006 00:11]

Report message to a moderator

Re: add StatusBar fields [message #1906 is a reply to message #1903] Sun, 26 March 2006 10:46 Go to previous message
mirek is currently offline  mirek
Messages: 13639
Registered: November 2005
Ultimate Member
barpas wrote on Sat, 25 March 2006 18:09

of course You are right i know this, if i dont know how to use somethig (eg widgets) i search this catalog by words inside files ...



Great, that is my original intention Smile

Mirek
Previous Topic: How do I add a StatusBar on my window
Next Topic: Statusbar disappears
Goto Forum:
  


Current Time: Wed Jun 29 05:34:22 CEST 2022

Total time taken to generate the page: 0.01882 seconds