<div dir="auto">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.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 6 May 2022 at 2:28 AM Hilaire Fernandes via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
<div text="#000000" bgcolor="#FFFFFF">
<p><font size="4" style="color:rgb(0,0,0)">Hi, <br>
</font></p>
<p><font size="4" style="color:rgb(0,0,0)">When saved then loaded, the preferences installed
with event listener lost the event listener:</font></p>
<p><font size="4" face="monospace" style="font-family:monospace;color:rgb(151,8,45)">PreferenceNG
initialize.<br>
</font><font size="4" face="monospace" style="font-family:monospace;color:rgb(151,8,45)">(PreferenceNG
instanceAt: #guiElementsSize ) actionMap<br>
</font><font size="4" face="monospace" style="font-family:monospace;color:rgb(151,8,45)">==> an
IdentityDictionary(#preferenceChanged->WeakMessageSend(#defaultFontSize:
-> PreferenceNG) ) </font></p>
<p><font size="4" style="color:rgb(0,0,0)"><font face="monospace" style="font-family:monospace;color:rgb(151,8,45)">PreferenceNG
saveAllTo: '/tmp/pref' asFileEntry.<br>
PreferenceNG loadFrom: '/tmp/pref' asFileEntry.<br>
<br>
(PreferenceNG instanceAt: #guiElementsSize ) actionMap <br>
==> nil </font><br>
</font></p>
<p><font size="4" style="color:rgb(0,0,0)">To save all the preference, I use a naive:</font></p>
<p><font size="4" style="color:rgb(0,0,0)"><font face="monospace" style="font-family:monospace;color:rgb(151,8,45)">PreferenceNG>>saveAllTo:
aFileEntry<br>
" Save all the preferences to a file "<br>
SmartRefStream dumpOnFile: aFileEntry object:
ThePreferences</font><br>
</font></p>
<p><font size="4" style="color:rgb(0,0,0)">To load, the counter part:</font></p>
<p><font size="4" style="color:rgb(0,0,0)"><font face="monospace" style="font-family:monospace;color:rgb(151,8,45)">PreferenceNG>>loadFrom:
aFileEntry<br>
" Load all preferences from file, it replaces entirely the
existing preferences "<br>
ThePreferences _ SmartRefStream restoreFromFile:
aFileEntry</font><br>
</font></p>
<p>This is not surprise as the actionMap is stored in another
object, the class ActiveModel. <br>
</p>
<p>I have some ideas to solve the problem but I am interested to
read other ideas.</p>
<p>Thanks</p>
<p>Hilaire</p></div><div text="#000000" bgcolor="#FFFFFF"><p><br>
</p>
<pre cols="72" style="font-family:monospace">--
GNU Dr. Geo
<a href="http://drgeo.eu" target="_blank" style="font-family:monospace">http://drgeo.eu</a>
<a href="http://blog.drgeo.eu" target="_blank" style="font-family:monospace">http://blog.drgeo.eu</a></pre>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>