Jump to content


Speed

Member Since 08 Jun 2005
Offline Last Active Mar 14 2024 06:16 AM
-----

Posts I've Made

In Topic: NxComboBox6 DropDown Button.

13 February 2024 - 03:30 AM

It seems to be intermittent.


In Topic: TUxNotificationsManager.

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


In Topic: TUxNotificationsManager.

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


In Topic: TUxNotificationsManager.

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


In Topic: TUxNotificationsManager.

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