Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a standard non-modal message dialog?

Tags:

delphi

I want to display message on PC which may not be attended. The user can read the message when he comes back.

Execution of my app must continue, so I need something non-modal. Before I starting code & creating new forms, I would like ask if there is something like `ShowMessage' which is non-modal.


[Update] Thanks for the feedback so far. I do know how to do it using a form, I just wondered if there something that would involve me writing less code. It seems not. I shall search the VCL component sites to see if someone has already inverted this particular wheel.

It looks like the short answer to my question is "no".

like image 373
Mawg says reinstate Monica Avatar asked May 14 '14 02:05

Mawg says reinstate Monica


2 Answers

From what I know - the answer is "no".

There's not much use of such non-modal message box because indeed, message box implies that program can not continue without getting users feedback (Yes/No/Ok/Cancel) or verifying user read it (Ok).

Without knowing other details, I guess you need a log, not a pile of unhandled message boxes. Worst case scenario, how many such messages do you expect to pile up if LAN breaks down, or something like that, 5, 20, 1000?

Create another form with a TMemo in it and when your program needs to report something - display the form and add the string to that Memo. So when the user returns back, he sees that log.

Making a custom TForm with a TMemo or TLabel on it and a public procedure AppendLog(aMsg: string); is a matter of 10min, much shorter than what you will spend on searches and definitely a better fit to your usage scenario.

like image 93
Kromster Avatar answered Oct 16 '22 03:10

Kromster


For only showing a notification message to user without interupting application workflow what you should use are Windows Balloon Tips. These are those Balloon shaped messages which pop-up above system tray. Easiest way of showing them with Delphi is to use TTrayIcon (available since Delphi XE if I'm not mistaken) http://docwiki.embarcadero.com/CodeExamples/XE5/en/TTrayIcon_(Delphi) http://docwiki.embarcadero.com/Libraries/XE5/en/Vcl.ExtCtrls.TTrayIcon

Default behavior of Balloon tips is that they stay visible when user is away from PC and only hide some time after user activity. So this almost guarante that user will see the message. You can set the time for this Balloon Tip to be visible. You can create a custom event which will be fired when user clicks on Balloon Tip (presenting some choice to the user for instance). Another advantage of Balloon Tips is that they don't popup when you are using any FullScreen aplications like games, movie players, etc. They will popu as soon as you leave the FullScreen mode of any of those applications.

like image 21
SilverWarior Avatar answered Oct 16 '22 03:10

SilverWarior