Jump to content


Photo

TUxNotificationsManager.


  • Please log in to reply
12 replies to this topic

#1 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 04 November 2023 - 01:18 AM

Hi Boki,

 

Is there any way to detect if a popup is already showing?

 

Let me explain.

 

If AutoClose is set to False, and a notification popup with the title of "Meeting" is showing, is there a way I can detect that this popup is already showing so I don't show the same popup again?

 

= Steve

 



#2 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 06 November 2023 - 01:09 AM

<bump>



#3 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 06 November 2023 - 02:53 AM

Is there also a way to detect if a reminder has been closed using the Close button?



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,212 posts
  • Gender:Male

Posted 06 November 2023 - 12:10 PM

Hello,

 

Unfortunately it's not possible to check if a specific popup is open, but I can add it. I will also try to add an event for OnClose for the popup.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 06 November 2023 - 10:54 PM

Hello,

 

Unfortunately it's not possible to check if a specific popup is open, but I can add it. I will also try to add an event for OnClose for the popup.

Thanks Boki, that would be awesome. 

 

In the meantime, I got around it by adding the popup text to a TStringList and then checking to see if it's in the list.  I can't get around the OnClose event though.

 

= Steve



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,212 posts
  • Gender:Male

Posted 10 November 2023 - 08:15 PM

Hello Steve,

 

From the next version you will be able to find published UxControls6.NotificationControls (TList) variable. There you can find all currently open pop-ups.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 11 November 2023 - 12:06 AM

Hello Steve,

 

From the next version you will be able to find published UxControls6.NotificationControls (TList) variable. There you can find all currently open pop-ups.

Hi Boki,

 

That is brilliant!  Thank you.

 

= Steve



#8 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 24 November 2023 - 05:01 AM

Hello Steve,

 

From the next version you will be able to find published UxControls6.NotificationControls (TList) variable. There you can find all currently open pop-ups.

Has this version been released, or is it still in dev?

 

= Steve



#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,212 posts
  • Gender:Male

Posted 24 November 2023 - 10:40 AM

Hello Steve,

 

Its released.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#10 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 25 November 2023 - 01:40 AM

Thanks Boki.

 

I've hooked onto the TUxNotificationControl OnClose event, but there's no way to tell if the notification has been closed manually or autoclosed.

 

Is there code I can add to check that?

 

The reason for this is, if a notification is autoclosed, then I want it to appear again as the user may not be on their computer when the notification appears.  But if the user closes it manually, then it would become annoying for them if the notification kept popping up.

 

The plan is to delete the notification from the TList if the user manually clicks the close button.

 

What do you think?

 

= Steve



#11 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 25 November 2023 - 02:14 AM

Hi Boki,

 

Never mind, I worked it out.  In my event handler I can check which notification it is and whether or not it's set to AutoClose. :mellow:

   CodeSite.Send('TUxNotificationControl(Sender).Text', TUxNotificationControl(Sender).Text);

   if TUxNotificationControl(Sender).AutoClose then
   begin

   end
   else
   begin

   end;

= Steve



#12 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 25 November 2023 - 03:45 AM

Hi Boki,

 

I'm not sure if this is the correct way to do this but I get a List Index Out of Bounds (-1) error when I do.
 

procedure TfrmMain.ReminderClosed(Sender: TObject);
var
   ReminderIndex, NotificationsIndex, i: integer;
   Reminder: TUxNotificationControl;
   ReminderText: string;
begin
   // Get the reminder that has closed.
   ReminderText := TUxNotificationControl(Sender).Text;

   // This is not an AutoClose reminder so we can remove it from the list of reminders.
   if not TUxNotificationControl(Sender).AutoClose then
   begin
      // Find a match for this reminder
      for i:= (NotificationControls.Count - 1) downto 0 do
      begin
         Reminder := TUxNotificationControl(NotificationControls[i]);

         if SameText(Reminder.Text, ReminderText) then
         begin
            NotificationsIndex := NotificationControls.IndexOf(Pointer(Reminder));

            NotificationControls.Delete(NotificationsIndex);

            Break;
         end;
      end;
   end;
end;

The error occurs here in the UxControls6.pas unit, on the line shown in the attached image.  It's probably something I'm doing wrong.

 


= Steve

Attached Files



#13 Speed

Speed
  • Members
  • 198 posts
  • Gender:Male

Posted 25 November 2023 - 04:52 AM

Hi Boki,

 

Never mind.  The reminders are stored in a database, so when the user clicks close I'll just disable the reminder in the database.

 

= Steve






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users