Comments (1)
How can I add RichTextCtrl to Status bar? And use that instead to show rich text messages? I cannot add directly using AddFrame as its not a InfoCtrl.
I tried the following and add it to status bar, but its interfering with other status bar functions like progress bar etc.
`
struct RichInfoCtrl : InfoCtrl { RichTextCtrl richCtrl; RichInfoCtrl() { richCtrl.HSizePosZ(0, 0).VSizePosZ(0, 0); this->Add(richCtrl); Set(" "); // to clear default "Ready" text richCtrl = "Ready"; // use richtext instead } void SetMsg(String str) { richCtrl = str; } };
`
Is there a recommended way to add RichTextCtrl to status bar?
You can use smart text (RichText) in info widgets. Just use DrawSmartText function to paint text in the display.
Below is the modified version of uppsrc/reference/StatusBar example. It adds rich text support (Remember: there are also other ways to achive this):
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct PosDisplay : Display {
virtual void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const {
if(q.Is<String>())
Upp::DrawSmartText(w, 0, 0, r.Width(), q.To<String>()); // Draws the rich text;
}
};
struct App : TopWindow {
StatusBar status;
InfoCtrl x, y;
PosDisplay dx, dy;
virtual void MouseMove(Point p, dword)
{
String sx, sy;
sx << "\1[g@4=/ x: " << p.x << " ]"; // Rich text, green, centered, italic
sy << "\1[g@3>_ y: " << p.y << " ]"; // Rich text, red, right aligned, underlined
x.Set(PaintRect(dx, sx));
y.Set(PaintRect(dy, sy));
}
App() {
Sizeable();
SetFrame(FieldFrame());
AddFrame(status);
status.AddFrame(x.Left(100));
status.AddFrame(y.Left(100));
}
};
GUI_APP_MAIN
{
App().Run();
}
`
Edit: Simplified the example.
Best regards,
from ultimatepp.
Related Issues (20)
- TrayIconWin32 Message method discards "title"
- On Windows (Clang x64) FileSel returns all paths without path seperators HOT 2
- RichText, faulty condition check (condition is always false)
- How to make a transparent window? HOT 1
- Feature idea: "tagging" of reference examples HOT 1
- umk support for clang + msvc linker HOT 2
- Bug: crash for empty DropList HOT 5
- This is wonderful HOT 3
- TheIDE Screen Position & Mouse Click Handling Are Unusable HOT 14
- Simple StackPanel widget as in WPF(C#) ? HOT 5
- Alt+Tab switches window when creating new package causing desktop to fallback mode under Linux Mint 21.2 HOT 8
- How to let TheIDE use higher version clang/gcc to parse C++ code in std=c++17/20 HOT 12
- How to build treeview option using OptionTree or TreeCtrl? HOT 1
- TheIDE windows version shows parsing errors HOT 9
- Display::GetStdSize(const Value& q) const doesn't return size of image HOT 4
- Ubuntu 22 installation HOT 4
- Painter/Xform2D: Return statement is never reached. HOT 2
- File drag & drop does not work correctly if the path has a plus (+) sign in it. HOT 2
- add riscv64 support HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultimatepp.