Skip to content

Commit

Permalink
Fixed: Favorites in Resource Panel need to be refreshed in certain oc…
Browse files Browse the repository at this point in the history
…assions

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
  • Loading branch information
dpradov committed Mar 23, 2024
1 parent 2fbccba commit 6ba1e26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions kn_Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 8 additions & 0 deletions kn_Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6ba1e26

Please sign in to comment.