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 » Community » Newbie corner » Problem in example code (Tried SplitterFrame yet minor problem.)
Re: Problem in example code [message #45726 is a reply to message #45724] Tue, 29 December 2015 19:31 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

vegaonline wrote on Tue, 29 December 2015 17:25
Thanks for the remark. However, I am confused with your statement. If I can edit .lay file why can't I edit it in their text form?


Well, that you can do something doesn't really mean you should Smile If you modify the file in such a way that the editor in TheIDE will not understand it anymore, you might loose some information. I never actually tried that, so maybe the editor is clever enough to prevent this, but I wouldn't rely on it... The only reasonable situation where I would consider editing .lay file in its text form is when I wanted to do some Find&Replace to rename a bunch of widgets or some similar task that would be too tedious to do in the editor.

vegaonline wrote on Tue, 29 December 2015 17:25

For example I want to put a StaticText or label specifying foreground and background color. GUI editor shows only foreground color or INK COLOR.
How can I do this?

Things that can't be done in GUI editor are usually done in code. It is actually quite simple, e.g. to change the text of StaticText programatically:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;

#define LAYOUTFILE <MyApp/MyApp.lay>
#include <CtrlCore/lay.h>

class MyWindow : public WithMyLayout<TopWindow> {
	typedef MyWindow CLASSNAME;

public:
	MyWindow(){
		CtrlLayout(*this, "");
		MyStaticText.SetText("MyText");
	}

};

The exact case you ask for, changing background color, is actually kind of tricky Smile There is nothing like SetBackgroundColor method, but it is possible to change the background of the text itself. StaticText and many other widgets support QTF. It might look scary, but there is a nice editor in TheIDE (press Alt+Q). So to set The background of your text to blue, you'd do this:
MyStaticText.SetText(t_("\1[$(0.0.255) Test]")
The "\1" at the beginning denotes that the string should be treated as QTF, see the documentation here.

Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Issues using 2015.2 version
Next Topic: How to build FREBSD *.so in Windows?
Goto Forum:
  


Current Time: Thu May 09 19:06:00 CEST 2024

Total time taken to generate the page: 0.01200 seconds