From 6ba1e26d9f651d154e017683c0058cc0dd98c89a Mon Sep 17 00:00:00 2001 From: Daniel Prado Velasco Date: Sat, 23 Mar 2024 10:58:26 +0100 Subject: [PATCH] Fixed: Favorites in Resource Panel need to be refreshed in certain ocassions I was finally able to reproduce this issue once, enough to identify and fix it With the help of the 3rdParty TFormStorage control (RxPlacement.pas) KeyNote recovers the position and state of the windows (saved in the keynote.mru file). This occurs when the main KeyNote window is displayed, before it is activated. From what I had been observing, it seemed that this process ( =>TFormPlacement.RestorePlacement) ended before continuing to process other messages. But it didn't have to be that way. Sometimes (in my case very rare occasions) the Activate message (on the main form) is received before that process has finished. In this case, the active tab in the resources panel may not have been restored yet. But nevertheless, it is in FormActivate where the initial loading of the resource panel is carried out (on its active tab) Fortunately the TFormStorage control offers an event that reports the completion of the restore placement process. (In my case it is something very, very unusual. Few minutes after adding the code that clearly corrected the problem, the favorites panel began showing correctly on the startup, even commenting the new code) Refs: Favorites in Resource Panel need to be refreshed in 1.8.xx #631 "Resource Panel>Favorites, not autocomplete" #655 --- kn_Main.dfm | 1 + kn_Main.pas | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/kn_Main.dfm b/kn_Main.dfm index 87a5ddf..ff61bd5 100644 --- a/kn_Main.dfm +++ b/kn_Main.dfm @@ -3702,6 +3702,7 @@ object Form_Main: TForm_Main IniFileName = 'Software\General Frenetics\KeyNote\FormPos' IniSection = 'Main' UseRegistry = True + OnRestorePlacement = FormStorageRestorePlacement StoredProps.Strings = ( 'Pages_Res.Width' 'Pages_Res.ActivePage' diff --git a/kn_Main.pas b/kn_Main.pas index 736d793..4f435e0 100644 --- a/kn_Main.pas +++ b/kn_Main.pas @@ -1269,6 +1269,7 @@ TForm_Main = class(TForm) procedure MMTreeFocusTreeClick(Sender: TObject); procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure MMFindAllClick(Sender: TObject); + procedure FormStorageRestorePlacement(Sender: TObject); private { Private declarations } @@ -1743,6 +1744,13 @@ procedure TForm_Main.FormActivate(Sender: TObject); end; // ACTIVATE +procedure TForm_Main.FormStorageRestorePlacement(Sender: TObject); +begin + UpdateResPanelContents (false); +end; + + + procedure TForm_Main.ActivatePreviousInstance; var CopyData : TCopyDataStruct;