[Cuis-dev] Preferennce save/load and actionMap

Luciano Notarfrancesco luchiano at gmail.com
Thu May 5 13:07:55 PDT 2022


You can avoid replacing the existing instances by iterating over the
preferences you read from the file and setting their values on the existing
prefeences.

On Fri, 6 May 2022 at 2:28 AM Hilaire Fernandes via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi,
>
> When saved then loaded, the preferences installed with event listener lost
> the event listener:
>
> PreferenceNG initialize.
> (PreferenceNG instanceAt: #guiElementsSize ) actionMap
> ==> an
> IdentityDictionary(#preferenceChanged->WeakMessageSend(#defaultFontSize: ->
> PreferenceNG) )
>
> PreferenceNG saveAllTo: '/tmp/pref' asFileEntry.
> PreferenceNG loadFrom: '/tmp/pref' asFileEntry.
>
> (PreferenceNG instanceAt: #guiElementsSize ) actionMap
> ==> nil
>
> To save all the preference, I use a naive:
>
> PreferenceNG>>saveAllTo: aFileEntry
> " Save all the preferences to a file "
>     SmartRefStream dumpOnFile: aFileEntry object: ThePreferences
>
> To load, the counter part:
>
> PreferenceNG>>loadFrom: aFileEntry
> " Load all preferences from file, it replaces entirely the existing
> preferences "
>     ThePreferences _ SmartRefStream restoreFromFile: aFileEntry
>
> This is not surprise as the actionMap is stored in another object, the
> class ActiveModel.
>
> I have some ideas to solve the problem but I am interested to read other
> ideas.
>
> Thanks
>
> Hilaire
>
>
> --
> GNU Dr. Geohttp://drgeo.euhttp://blog.drgeo.eu
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220506/73c6af4c/attachment.htm>


More information about the Cuis-dev mailing list