|
|
Home » Developing U++ » UppHub » MessageCtrl: A passive notifications ctrl and manager. (A a usefule CtrlLib add-on.)
MessageCtrl: A passive notifications ctrl and manager. [message #49494] |
Sun, 18 February 2018 19:21  |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello all,
KDE (and some other DEs or apps) have a nice, non-intrusive ("passive") notifications widgets. Here is the U++ counterpart.
This is the initial release. Although it is working pretty well, glitches should be expected.
Message package works on whatever U++ works. on.
Package contains API docs and a reference example.
MessageCtrl package for U++
-----------------------------
This class implements a messages manager.
Messages are simple message boxes similar to prompts in that they can allow the same basic user
actions. However, message boxes are not meant as a replacement for the traditional U++ dialogs.
The main difference between the messages and the prompts is that the message boxes are implemented
as frames instead of dialogs, and are meant to be less intrusive, and non-blocking.
There are several types of messages:
- Information: Should be used to display common information.
- Warning: Should be used to report non-critical issue, to inform that everything is all right.
- Success: Should be used to display successful operations. Essentially this is an information notification.
- Question: Should be used to ask for some interaction.
- Error: Should be used to display critical application errors
- Custom: If the predefined notification types don't suit your needs, you can create one.
Message boxes use QTF texts. This allows for embedding hyperlinks in messages.
It also means that in some cases the text messages should be escaped, using DeQtf() function.
History:
--------------------
2018-04-07: UseCross() method added. It is now possible to use a
small image button with cross instead of OK button.
Informative message boxes use crosses by default.
2018-03-03: Name clash on Windows fixed.
MessageBox::Type::ERROR -> MessageBox::Type::FAILURE
Message display order changed. New messages will be inserted
as the the topmost/bottom-most frame (depending on orientation)
Selective clearing added.
2018-03-01: Information and custom message boxes can now have timeouts.
2018-02-21: Widget renames as MessageCtrl. (Final)
2018-02-20: It is now possible to add mesasges as both top and bottom frames.
It is now possible to add single message box without using the manager.
Message framework further refactored.
2018-02-19: Name change: Notification -> Message.
Code refactored. (Thanks Klugier!)
2018-02-18: Initial public release
You can find the package below on the bottom of this message, or
You can grab its source code from: https://github.com/ismail-yilmaz/upp-components/tree/master/ CtrlLib/MessageCtrl
Screenshot:

Please feel free to comment on it.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Fri, 06 April 2018 23:07] Report message to a moderator
|
|
|
|
|
|
Re: Message: A passive notifications ctrl and manager. [message #49499 is a reply to message #49496] |
Mon, 19 February 2018 15:01   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello Klugier,
Unfortunately, the highlight glitch doesn't seem to stem from my code.
It can be replicated as in the below code:
include <CtrlLib/CtrlLib.h>
using namespace Upp;
class RichTextTest : public TopWindow {
FrameTop<RichTextCtrl> qtf;
Button bt;
public:
RichTextTest()
{
SetRect(0, 0, 640, 480);
Sizeable().Zoomable().CenterScreen();
Add(bt.RightPos(4).BottomPos(4));
bt << [=] {
String z = "Hello World!";
qtf.VCenter(); // Comment out this line, and highlighting works.
qtf.SetQTF("[G1 " << z);
qtf.Height(40); // As the height increases, highlighting becomes impossible.
// This problem doesn't arise with wrapped (Line > 1) text
qtf.SetFrame(FieldFrame());
AddFrame(qtf);
};
}
};
GUI_APP_MAIN
{
RichTextTest().Run();
}
Maybe the glitch is in the RichTextEdit's text centering method?
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 19 February 2018 15:03] Report message to a moderator
|
|
|
|
|
|
Re: Message: A passive notifications ctrl and manager. [message #49505 is a reply to message #49504] |
Wed, 21 February 2018 00:02   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello,
I was thinking about your code and I think it's final name should be MessageCtrl. Ctrl prefix in upp world means any graphical control, that you can use in your own code. In the Message class we are solving such problem. Please, let me know what do you think?
Message is too general. It could also represent chat message or IPC message etc.
____________
Some time ago, I also created "Associated projects" website to collect interesting projects related to the Upp. If you have any comments related to that page, please let me know.
Sincerely,
Klugier
[Updated on: Wed, 21 February 2018 00:11] Report message to a moderator
|
|
|
Re: Message: A passive notifications ctrl and manager. [message #49506 is a reply to message #49505] |
Wed, 21 February 2018 00:25   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello Klugier,
Quote:Hello,
I was thinking about your code and I think it's final name should be MessageCtrl. Ctrl prefix in upp world means any graphical control, that you can use in your own code. In the Message class we are solving such problem. Please, let me know what do you think?
Message is too general. It could also represent chat message or IPC message etc.
____________
Some time ago, I also created "Associated projects" website to collect interesting projects related to the Upp. If you have any comments related to that page, please let me know.
Well, I have no objections to rename it to MessageCtrl & MessageBox as its helper.
It makes sense.I'll commit the changes tomorrow.
Regarding the page: I bave noticed it recently, and I have to thank you for listing my repository there. 
Aside from that, the only thing that is annoying on that page is, it is rather empty. And it is a shame, because U++ is an excellent tool.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Wed, 21 February 2018 00:26] Report message to a moderator
|
|
|
|
|
|
|
|
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49573 is a reply to message #49572] |
Sun, 04 March 2018 13:10   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello Luigi,
Quote:
now it works. I just needed a similar widget, thanks!
I have few questions:
1) I saw that the new message, even if Top() is set are appended to the existing ones.
Is it possible that the most recent message enter from top and appear on first row? In this way the user can observe only the first row.
2) Moreover, is it possible to add a message without any button?
3) It would be nice to set a maximum number of messages, the most recent, and delete automatically the others that become obsolete.
1) Done (see package) It is the default behaviour now. 
I may also add Append() if requested.
2) Yes this is possible too. But I have some reservations about this.
It might make sense to add this option to MessageBox, but IMO this should be restricted to Information type message box. (as with the timeout).
Others (Error, Success, Warning, Question) need to stay, and wait for confirmation, since they are although informational, yet important messages.
So here's what I propose: I'll add it as an option to both Custom message boxes, and Information boxes (with a default timeout)
3) I don't quite understand this one. You ask me to add a message limit, time limit, or something else? Could you elaborate a little more?
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sun, 04 March 2018 13:25] Report message to a moderator
|
|
|
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49575 is a reply to message #49573] |
Sun, 04 March 2018 16:56   |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Oblivion wrote on Sun, 04 March 2018 13:10Hello Luigi,
1) Done (see package) It is the default behaviour now. 
I may also add Append() if requested.
2) Yes this is possible too. But I have some reservations about this.
It might make sense to add this option to MessageBox, but IMO this should be restricted to Information type message box. (as with the timeout).
Others (Error, Success, Warning, Question) need to stay, and wait for confirmation, since they are although informational, yet important messages.
So here's what I propose: I'll add it as an option to both Custom message boxes, and Information boxes (with a default timeout)
3) I don't quite understand this one. You ask me to add a message limit, time limit, or something else? Could you elaborate a little more?
Best regards,
Oblivion
Hello Oblivion,
Thanks a lot for the upgrade! Now it looks better for my needs.
However an Append() method could be useful in some cases and make the Ctrl more flexible.
For request #2, I do not intend substitute your Ctrl, just add an option to hide the button to not suggest to press it.
In my program the user performs some selection on two separate lists. Some of his choice are legal, other illegal and other legal although problematic. Depending on his choice your Ctrl may signal him what he is doing. The message should only inform him in a not blocking way (I would not force him to push a button). Actually I do this in a ugly way with a label that set different colored images.
For #3 the limit should refer to the visible messages, for example only the latest 3. In the previous case, while the user do his task the messages appear from top but only the latest are important, so make no sense to show all of them.
Best regards,
Luigi
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 09 09:31:05 CEST 2025
Total time taken to generate the page: 0.00981 seconds
|
|
|