Recent

Author Topic: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert  (Read 2303 times)

kevin.black

  • Full Member
  • ***
  • Posts: 121
You know those alerts that appear in Windows (when someone shares a Dropbox folder with you or when a USB Drive is removed for example), and similarly on macOS?

Is there are component or bit of code that allows you to either replicate those alerts or preferably actually to setup and configure/execute those alerts. They should work like the platform they are on, appear briefly, disappear and allow for multiple alerts. So that several alerts can be triggered almost instantaneously and they all appear (ie. a new alert doesn't clobber an older alert).

If not cross platform, happy to do the {$IFDEF... thing, but obviously easier if Cross platform.

Thanks

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert
« Reply #1 on: March 20, 2019, 02:02:26 am »
You mean like Windows notifications?

I'm not aware of a cross-platform way of doing it. In Linux, for example, it depends quite heavily on the DE, WM, theme engine, etc.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert
« Reply #2 on: March 20, 2019, 04:34:47 am »
I use TPopupNotifier and works fine in Linux and Windows.

http://wiki.freepascal.org/TPopupNotifier
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

kevin.black

  • Full Member
  • ***
  • Posts: 121
Re: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert
« Reply #3 on: March 20, 2019, 05:31:04 am »
@Lucamar,

Yes I guess, in windows 10 see attached image, and for macOS see attached image of the popup. One is a popup and the other using the notification centre, either would be fine.

As noted, don't care if I have to write code for each OS, but I'd like to tie it into the native OS look and feel.

@GAN,

That would be fine except I need some way to have many at once as in the (I think) JVCL AlertNotifier, which has an alert queue. So essentially if the TPopupNotifier had an AlertMessage queue, it would be fine. See the Facebook notifications image for example.

EDIT:

Similar to the TPopupNotifier is the RxPopupNotifier. It is essentially an expanded version with additional properties for height, width, duration etc AND PopupNotifierItem which I think is one of a collection of alerts. I'm trying it out now. Thanks for the heads, it pointed me in this direction.

https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/rx/


« Last Edit: March 20, 2019, 07:31:32 am by kevin.black »

kevin.black

  • Full Member
  • ***
  • Posts: 121
Re: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert
« Reply #4 on: March 20, 2019, 07:32:13 am »
Had to reply to add the other image:

From what I have seen with the Demo and now trying to implement, it does what I want it to. here's the code that adds a Dynamic popup notification (ie. it stacks them), from their demo (the point being it's fairly simple). This adds a popup to the stack and display its, many of the settings can be preset, they are just reading things from the screen, like checkboxes and radio buttons.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button5Click(Sender: TObject);
  2. var
  3.   R1: TRxPopupNotifierItem;
  4. begin
  5.   Inc(FCurID);
  6.   R1:=RxPopupNotifier1.AddNotifyItem('Warning', 'Error message № ' + IntToStr(FCurID));
  7.   R1.ShowCloseTimer:=CheckBox1.Checked;
  8.   R1.Color:=ColorBox1.Selected;
  9. end;

And it looks like the image attached.

kevin.black

  • Full Member
  • ***
  • Posts: 121
Re: Alerts (Cross-Platform)? Component or Code - Prefer Native OS Alert
« Reply #5 on: March 28, 2019, 12:41:44 am »
I provide this simply for information.

As you may (or may not) know I'm porting Windows Delphi to OSX Lazarus because (and even as of D10.3.1) no Delphi 64 bit and nothing at all likely (I find the Embarcadero website totally misleading, that's a polite was of saying full of BS). The other developer is C++ guy and is moving into swift on the mac. I digress.

I did use the rxPopupNotifier component (same as the popup notifier, but stackable and without the icon/image). I screwed the whole install up trying to add an image - my bad.

As I was struggling with this notifier (and now modal forms in DYLIBS), the other developer said: 'Don't worry, not cross platform, but here it is, save a couple of weeks'. AND damn, if it doesn't look good, I am seriously envious see images (the notification centre is a bit of a hack, but you get the gist):

So another question:

REMOVE the cross platform notification part of the earlier question. Is there some way I can get into the OSX popup Notifications and notification centre per images attached?



 

TinyPortal © 2005-2018