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 » 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 Go to next message
Oblivion is currently offline  Oblivion
Messages: 1091
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:
https://image.ibb.co/c9cRT7/Notifications.png

Please feel free to comment on it.

Best regards,
Oblivion






[Updated on: Fri, 06 April 2018 23:07]

Report message to a moderator

Re: Notification: A passive notifications ctrl and manager. [message #49495 is a reply to message #49494] Sun, 18 February 2018 20:58 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

Look nice! However, I found some minor glitch when selecting notification content. Here is screen-shot:
index.php?t=getfile&id=5508&private=0

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: Notification: A passive notifications ctrl and manager. [message #49496 is a reply to message #49495] Sun, 18 February 2018 21:28 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

I made small code review on GitHub. I would be grateful if you will address my comments. Here is the review.

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: Message: A passive notifications ctrl and manager. [message #49497 is a reply to message #49496] Mon, 19 February 2018 01:10 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Klugier,

I made the modifications you've suggested. Also I've changed the package name to "Message"
Thanks for the review!

I'll investigate the glitch. (Seems like it happens only with single-line messages, when RichTextCtrl::VCenter() is on.

Best regards,
Oblivion



[Updated on: Mon, 19 February 2018 01:11]

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 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
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


[Updated on: Mon, 19 February 2018 15:03]

Report message to a moderator

Re: Message: A passive notifications ctrl and manager. [message #49501 is a reply to message #49499] Mon, 19 February 2018 22:12 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

It seems that your url to package returns 404 error (Not found) after the package name chaining. Can you fix it?

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: Message: A passive notifications ctrl and manager. [message #49502 is a reply to message #49501] Mon, 19 February 2018 22:35 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Link fixed.



Best regards,
Oblivion


Re: Message: A passive notifications ctrl and manager. [message #49504 is a reply to message #49501] Tue, 20 February 2018 17:46 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Klugier, and all.

I've further refactored and cleaned up the code.
Also, I updated the example.

2918-02-20: It is now possible to add messages as both top and bottom frames.
            It is now possible to add single message box without using the manager.
            Message framework further refactored.



Screenshot:

index.php?t=getfile&id=5514&private=0


Please feel free to comment on it.

Best regards,
Oblivion
  • Attachment: Message.png
    (Size: 30.09KB, Downloaded 1193 times)


[Updated on: Tue, 20 February 2018 18:08]

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 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
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 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
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. Smile
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


[Updated on: Wed, 21 February 2018 00:26]

Report message to a moderator

Re: Message: A passive notifications ctrl and manager. [message #49512 is a reply to message #49505] Wed, 21 February 2018 20:18 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Klugier,
Widget is renamed to MessageCtrl. (Final name)


Best regards,
Oblivion


Re: MessageCtrl: A passive notifications ctrl and manager. [message #49561 is a reply to message #49494] Fri, 02 March 2018 01:45 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello,

MessageCtrl gained timeout support.
It is now possible to display time-constrained message boxes. (Restricted to information and custom type message boxes)

Reference example is updated accordingly.

See first message of this topic for GIT address and/or zipped package.

Best regards,
Oblivion


[Updated on: Fri, 02 March 2018 01:47]

Report message to a moderator

Re: MessageCtrl: A passive notifications ctrl and manager. [message #49570 is a reply to message #49561] Sun, 04 March 2018 08:33 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Oblivion wrote on Fri, 02 March 2018 01:45


See first message of this topic for GIT address and/or zipped package.

Oblivion


Hi Oblivion,

I got the package from your first message. I put both packages in MyApps and compiled with Minggw.
Because I got many compiler error I wonder if you tested the package with Minggw or I am missing some configuration.
Thanks,
Luigi
index.php?t=getfile&id=5518&private=0
  • Attachment: pic1.png
    (Size: 83.42KB, Downloaded 1161 times)
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49571 is a reply to message #49570] Sun, 04 March 2018 10:40 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Luigi,

Thanks for the report!

It seems that a name clash have happened after I refactored the code.
It should be fixed now. I updated the package. (In the first message)

Could you please check it?

Best regards,
Oblivion.


Re: MessageCtrl: A passive notifications ctrl and manager. [message #49572 is a reply to message #49571] Sun, 04 March 2018 12:35 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Oblivion wrote on Sun, 04 March 2018 10:40

Could you please check it?
Oblivion.


Hi Oblivion,

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.

Best regards,
Luigi
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49573 is a reply to message #49572] Sun, 04 March 2018 13:10 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
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. Smile
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


[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 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Oblivion wrote on Sun, 04 March 2018 13:10
Hello Luigi,

1) Done (see package) It is the default behaviour now. Smile
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
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49576 is a reply to message #49575] Sun, 04 March 2018 21:05 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1091
Registered: August 2007
Senior Contributor
Hello Luigi,

Package and example updated.

MessageCtrl: Append() method added.
MessageCtrl: Selective clearing added. (You can target a specific ctrl for clearing).


Regarding the buttonless informative message boxes: I will add them as an option.

How to proceed?
Should I add an overlay icon that only appears when the mouse pointer is near, or should I just let them have a timeout?

Limiting the number of displayed message boxes is also possible and trivial, yet it'll need some internal changes. I'll look into it in the following days.

By the way, you can use each and every type of MessageBox without using MessageCtrl. MessageCtrl is a simple manager for MessageBoxes.

Best regards,
Oblivion.


[Updated on: Sun, 04 March 2018 21:13]

Report message to a moderator

Re: MessageCtrl: A passive notifications ctrl and manager. [message #49577 is a reply to message #49576] Sun, 04 March 2018 23:38 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Oblivion wrote on Sun, 04 March 2018 21:05

Regarding the buttonless informative message boxes: I will add them as an option.

How to proceed?
Should I add an overlay icon that only appears when the mouse pointer is near, or should I just let them have a timeout?


I am not sure to have understood your question. For the buttonless informative message I was thinking at a message that can stay forever in the list. If something else happens a new message appear on top, while the previous and now obsolete message shift down.
However the possibility to set a timeout for the message can be very useful. For example TIMEOUT = 0 means stay forever and any value greater than 0 means stay that amount of time.

Thank you very much!
Luigi
Re: MessageCtrl: A passive notifications ctrl and manager. [message #49602 is a reply to message #49577] Sun, 11 March 2018 12:03 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hi Oblivion,

today I tried to test MessageCtrl with a layout file. After dropping the ctrl on the .lay file as user class the compiler complained:


C:\upp/uppsrc/CtrlCore/TopWindow.h (204): required from 'void Upp::CtrlLayout(T&) [with T = MessageLay]'
C:\MyApps\MessageLay\MessageLay.h (10): In file included from C:\MyApps\MessageLay\MessageLay.h:10:0,
C:\MyApps\MessageLay\main.cpp (1): from C:\MyApps\MessageLay\main.cpp:1:
C:\upp/uppsrc/CtrlCore/TopWindow.h (212): required from 'void Upp::CtrlLayout(T&, const char*) [with T = MessageLay]'
C:\MyApps\MessageLay\main.cpp (5): required from here
C:\MyApps/MessageLay/MessageLay.lay (2): error: 'class Upp::MessageCtrl' has no member named 'HSizePosZ'
C:\upp/uppsrc/CtrlCore/lay.h (57): error: 'class Upp::MessageCtrl' has no member named 'LayoutId'
C:\upp/uppsrc/CtrlCore/lay.h (57): error: no matching function for call to 'Upp::Ctrl::Add(Upp::MessageCtrl&)'

Does the ctrl needs some more nethods to better integrate with current layout file or am I missing something?

Thanks,
Luigi
Previous Topic: GDAL status
Next Topic: Sharing a few small packages
Goto Forum:
  


Current Time: Thu Mar 28 23:11:29 CET 2024

Total time taken to generate the page: 0.00956 seconds