ddablib / wdwstate

Window State Components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TPJWdwState - using Restore and Save methods other than Form's OnShow and OnHide

delphidabbler opened this issue · comments

Recreated from delphidabbler/ddablib repository issue 3

Recreated from SourceForge ticket no.35

Project: wdwstate

Original creator was Ivo Ungermann - 2016-01-03

Even if demos recommend using form's Show and Hide as places for Restore and Restore methods of TPJWdwState components, there can be reasons to place it e.g. in Create and Destroy. And there is code in Restore method reflecting this situation and factical restoring is to be postponed for time of form showing. In contrast, Save method doesn't check if factical restoring took place (affected form is not shown during session) and form's design-time state is saved instead. There is my correction of Save method source code:

begin
Assert(not (csDesigning in ComponentState));

// Check if there is an owning window - get out if not
if fWindow = nil then
Exit;

if fRestorePending then
Exit;

Other similar components can be affected the same way.

Recreated from delphidabbler/ddablib repository issue 3

Recreated from SourceForge ticket no.35

Reply from: Peter Johnson ( @delphidabbler ) - 2021-09-14

Well it's taken a while - I've not been maintaining this code, but i see the sense in this.

Sorry for the horrendous delay