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 » U++ Library : Other (not classified elsewhere) » StaticText : Add missing GetData/SetData overloads
StaticText : Add missing GetData/SetData overloads [message #49696] Thu, 05 April 2018 11:45 Go to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
class StaticText : public Ctrl, public LabelBase {
public:
	virtual void   Paint(Draw& w);
	virtual Size   GetMinSize() const;
	virtual void   LabelUpdate();
	virtual void   SetData(const Value& v)              { SetText((String)v);}                 // <<---  
	virtual Value  GetData() const                      { return GetText();}                   // <<---  

public:
	StaticText& SetFont(Font font)                      { LabelBase::SetFont(font); return *this; }
	StaticText& SetInk(Color color)                     { LabelBase::SetInk(color); return *this; }
	StaticText& SetAlign(int align)                     { LabelBase::SetAlign(align); return *this; }
	StaticText& SetImage(const Image& img, int spc = 0) { LabelBase::SetImage(img, spc); return *this; }
	StaticText& SetText(const char *text)               { LabelBase::SetText(text); return *this; }

	StaticText& operator=(const char *s)                { SetText(s); return *this; }

	StaticText();
};



regards
omari.

[Updated on: Mon, 04 March 2019 15:56]

Report message to a moderator

Re: [FEATURE + patch] StaticText : Add missing GetData/SetData overloads [message #49718 is a reply to message #49696] Fri, 13 April 2018 10:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, I guess I cannot resist this any more...

The reason why I have resisted is that static texts are not part of dialog "value". Default implementation of Ctrl::Serialize is using GetData/SetData and it is used by TopWindow cancel mechanism. So in turn, adding GetData / SetData to Label can lead to some unexpected behaviour. To that end, I have also added override of Serialize, Jsonize and Xmlize. Please check...

Mirek
Re: [FEATURE + patch] StaticText : Add missing GetData/SetData overloads [message #49742 is a reply to message #49718] Wed, 18 April 2018 09:05 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Unfortunately, I had to rollback this change, as I have found code that really considers Label text as decoration and Label having no value at all, so assigning Null to it is not supposed to change the decoration.
Previous Topic: RegExp: newlines in replacement string
Next Topic: draganddrop does not work
Goto Forum:
  


Current Time: Thu Apr 18 15:01:25 CEST 2024

Total time taken to generate the page: 0.01382 seconds