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 » Menus&Toolbars » ToolButton: Label Patch!
ToolButton: Label Patch! [message #26932] Thu, 10 June 2010 15:56 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello all!

I propose to change a little Label method from ToolButton class:
from:
ToolButton& Label(const char *text, int kind = ToolButton::RIGHTLABEL);

to:
ToolButton& Label(const char *text, int kind);
	ToolButton& Label(const String &text) {Label(text, text.IsEmpty() ? ToolButton::NOLABEL : ((kind = ToolButton::NOLABEL)||(kind = ToolButton::FORCE)) ? ToolButton::RIGHTLABEL : kind);};


In this case, when i set label, kind option will change and did not call sepparate method "ToolButton& Kind(int _kind)"

and cpp file:
from:
ToolButton& ToolButton::Label(const char *text, int _kind)
{
	if(!(kind & FORCE)) {
		kind = _kind;
		Refresh();
	}
	Text(text);
	return *this;
}

to:
ToolButton& ToolButton::Label(const char *text, int _kind)
{
	if(_kind!=kind) {
		kind = _kind;
		Refresh();
	}
	Text(text);
	return *this;
}
Re: ToolButton: Label Patch! [message #26955 is a reply to message #26932] Sun, 13 June 2010 18:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, applied in less complex form.

Mirek
Re: ToolButton: Label Patch! [message #26956 is a reply to message #26955] Sun, 13 June 2010 19:54 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

luzr wrote on Sun, 13 June 2010 19:45

OK, applied in less complex form.

Mirek
Thank you!
Re: ToolButton: Label Patch! [message #27361 is a reply to message #26955] Wed, 14 July 2010 15:19 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

luzr wrote on Sun, 13 June 2010 19:45

OK, applied in less complex form.

Mirek


Mirek, When I set label text the control did not refresh.

The code need to change from:
ToolButton& ToolButton::Label(const char *text, int _kind)
{
	if(kind != _kind) {
		kind = _kind;
==>>REMOVE	Refresh();
	}
	Text(text);
	return *this;
}

to
ToolButton& ToolButton::Label(const char *text, int _kind)
{
	if(kind != _kind) {
		kind = _kind;
	}
	Text(text);
==>>ADD	Refresh();
	return *this;
}


The flat file is provided!

Thank you.

Ion Lupascu (tojocky)
Re: ToolButton: Label Patch! [message #27425 is a reply to message #27361] Sat, 17 July 2010 10:11 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I guess Text needs Refresh too, so I have placed it there.
Previous Topic: ToolBar's context menu
Next Topic: Tray Menu alignement bug
Goto Forum:
  


Current Time: Fri Mar 29 06:52:42 CET 2024

Total time taken to generate the page: 0.02904 seconds