<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: Persisting 'applications'</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Chris</FONT>
</P>

<P><FONT SIZE=2>Thanks very much for the response. </FONT>
</P>
<BR>

<P><FONT SIZE=2>&gt; Magma does support blocks and I just verified the</FONT>
<BR><FONT SIZE=2>&gt; #testBlocks tests three different BlockContexts with</FONT>
<BR><FONT SIZE=2>&gt; various characteristics, one includes a 'self'</FONT>
<BR><FONT SIZE=2>&gt; reference.&nbsp; So on the surface, it seems like it should</FONT>
<BR><FONT SIZE=2>&gt; work.</FONT>
</P>

<P><FONT SIZE=2>I must be doing something a little off-track somewhere.</FONT>
</P>

<P><FONT SIZE=2>&gt; Having said that, did you happen to ever save a change</FONT>
<BR><FONT SIZE=2>&gt; to that #initialize method in the debugger at some</FONT>
<BR><FONT SIZE=2>&gt; point?&nbsp; MethodContexts on the stack referring to the</FONT>
<BR><FONT SIZE=2>&gt; CompiledMethod being changed may undergo some</FONT>
<BR><FONT SIZE=2>&gt; transformation.&nbsp; An existing instance of that Morph</FONT>
<BR><FONT SIZE=2>&gt; was persisted in the db; for one its MethodContext on</FONT>
<BR><FONT SIZE=2>&gt; the stack at the time is suddenly not pointing to the</FONT>
<BR><FONT SIZE=2>&gt; CompiledMethod installed in the class.</FONT>
</P>

<P><FONT SIZE=2>That didn't make any difference. I thought it wouldn't because it's a fresh image and it happens on all the interactors on all components.</FONT></P>

<P><FONT SIZE=2>&gt; So you could try to resave the #initialize method and</FONT>
<BR><FONT SIZE=2>&gt; re-commit all your SDR1000Morphs to the db.&nbsp; That</FONT>
<BR><FONT SIZE=2>&gt; might get it working, but there is still the main</FONT>
<BR><FONT SIZE=2>&gt; caveat with storing BlockContext and MethodContexts in</FONT>
<BR><FONT SIZE=2>&gt; the database for &quot;long-term behavior&quot; such as this;</FONT>
<BR><FONT SIZE=2>&gt; they become stale as soon as the code changes because</FONT>
<BR><FONT SIZE=2>&gt; they refer to the old CompiledMethod object, not the</FONT>
<BR><FONT SIZE=2>&gt; current one.&nbsp; This could cause some real confusion</FONT>
<BR><FONT SIZE=2>&gt; much later if you have lots of stored instances not</FONT>
<BR><FONT SIZE=2>&gt; behaving as the current method source indicates; they</FONT>
<BR><FONT SIZE=2>&gt; are running the old CompiledMethod which now executes</FONT>
<BR><FONT SIZE=2>&gt; in a DoIt Context I think.</FONT>
</P>

<P><FONT SIZE=2>Thanks, yes I understand the problem.&nbsp; </FONT>
</P>

<P><FONT SIZE=2>&gt; This is such as simple block anyway that you may want</FONT>
<BR><FONT SIZE=2>&gt; to consider using a MessageSend instead.&nbsp; This is a</FONT>
<BR><FONT SIZE=2>&gt; standard object that can be used instead of the Block.</FONT>
<BR><FONT SIZE=2>&gt;&nbsp; Try changing your assignment to resetButton to</FONT>
<BR><FONT SIZE=2>&gt; something like this:</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resetButton := </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (SDRButton </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newWithParams: 'Reset' </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; actionSelector: #(#RESETHW) </FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; actionTarget:</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (MessageSend</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; receiver: self</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selector: #buttonAction:).</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Now, I see MessageSend answers to #value and</FONT>
<BR><FONT SIZE=2>&gt; #valueWithArguments: but I don't see #value: which may</FONT>
<BR><FONT SIZE=2>&gt; be required.&nbsp; So you may need to add</FONT>
<BR><FONT SIZE=2>&gt; MessageSend&gt;&gt;#value:.</FONT>
</P>

<P><FONT SIZE=2>&gt; value: anObject</FONT>
<BR><FONT SIZE=2>&gt;&nbsp;&nbsp; ^ self valueWithArguments: { anObject }</FONT>
</P>

<P><FONT SIZE=2>&gt; This might help solve your problem and you might be</FONT>
<BR><FONT SIZE=2>&gt; happier with a MessageSend in the long run anyway</FONT>
<BR><FONT SIZE=2>&gt; because it will stay &quot;current&quot; with the code.</FONT>
</P>

<P><FONT SIZE=2>Ok, I will think about doing that. There are two blocks involved here though as there is a level of indirection. The first one above calls a method which looks up #RESETHW in the server dictionary to get another block which calls the target method. In this simple case the target method is also in this component but in most cases it is on one or more of the connected components, the other end of the connector link (i.e. when the link is connected the maps get exchanged and in this case of course self is the target). Do you think I'm flogging a dead horse here? I will fabricate a simple case with message send and see if that works.</FONT></P>

<P><FONT SIZE=2>Thanks</FONT>
<BR><FONT SIZE=2>Bob</FONT>
</P>
<BR>

<P><FONT SIZE=2>--- &quot;Cowdery, Bob [UK]&quot; &lt;Bob.Cowdery@CGI-Europe.com&gt;</FONT>
<BR><FONT SIZE=2>wrote:</FONT>
</P>

<P><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Chris</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Sorry, but I am going to have to ask for help again.</FONT>
<BR><FONT SIZE=2>&gt; I can now manage</FONT>
<BR><FONT SIZE=2>&gt; the lifetimes in the database and image. Although it</FONT>
<BR><FONT SIZE=2>&gt; took me a while to</FONT>
<BR><FONT SIZE=2>&gt; get the process repeatable and figure out where all</FONT>
<BR><FONT SIZE=2>&gt; the references were.</FONT>
<BR><FONT SIZE=2>&gt; However, it now works and connectors stay connected.</FONT>
<BR><FONT SIZE=2>&gt; Unfortunately now</FONT>
<BR><FONT SIZE=2>&gt; that I am really retrieving from the database a</FONT>
<BR><FONT SIZE=2>&gt; retrieved app does not</FONT>
<BR><FONT SIZE=2>&gt; work. At least none of the UI events work, but then</FONT>
<BR><FONT SIZE=2>&gt; I am using dynamic</FONT>
<BR><FONT SIZE=2>&gt; techniques to hook everything together. I have a</FONT>
<BR><FONT SIZE=2>&gt; taken a simple case</FONT>
<BR><FONT SIZE=2>&gt; which is one composite component with one button on</FONT>
<BR><FONT SIZE=2>&gt; it. The button fires</FONT>
<BR><FONT SIZE=2>&gt; a block which references self in this case. However,</FONT>
<BR><FONT SIZE=2>&gt; self appears to be</FONT>
<BR><FONT SIZE=2>&gt; nil. This is where it fails.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; DoIt</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | t1 t2 t3 t4 t5 |</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super initialize.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t2 := ImageMorph new.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t3 := GraphicPath , 'sdr1000.gif'.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t2</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setNewImageFrom: (Form fromFileNamed: t3).</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t1 := SDRButton</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newWithParams: 'Reset'</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; actionSelector: #(#RESETHW )</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; actionTarget: [:t6 | self buttonAction:</FONT>
<BR><FONT SIZE=2>&gt; t6].</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self borderWidth: 2.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self borderColor: #complexFramed.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self color: Color gray.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self addMorph: t2.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self addMorph: t1.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t4 := t2 extent.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t5 := t1 extent.</FONT>
<BR><FONT SIZE=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self extent: t4 x + t5 x + 8 @ (t4 y + 8)</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; MessageNotUnderstood Undefined object buttonAction.</FONT>
<BR><FONT SIZE=2>&gt; This method called</FONT>
<BR><FONT SIZE=2>&gt; DoIt seems to be my Initialize method with the</FONT>
<BR><FONT SIZE=2>&gt; variables replaced with</FONT>
<BR><FONT SIZE=2>&gt; generated names. GraphicPath refers to a pool</FONT>
<BR><FONT SIZE=2>&gt; dictionary which it also</FONT>
<BR><FONT SIZE=2>&gt; can't resolve, don't know if that's relevant.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I have attached the file. The button is set up in</FONT>
<BR><FONT SIZE=2>&gt; the SDR1000Morph</FONT>
<BR><FONT SIZE=2>&gt; Initialize. It is called through the block in the</FONT>
<BR><FONT SIZE=2>&gt; dictionary set up by</FONT>
<BR><FONT SIZE=2>&gt; SDR1000Controller createServerInterfaceMap at</FONT>
<BR><FONT SIZE=2>&gt; #RESETHW.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; I know this is a lot to ask. If it's not obvious</FONT>
<BR><FONT SIZE=2>&gt; what I need to do</FONT>
<BR><FONT SIZE=2>&gt; please don't labour over it.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; Thanks</FONT>
<BR><FONT SIZE=2>&gt; Bob</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
<BR><FONT SIZE=2>&gt; *** Confidentiality Notice ***</FONT>
<BR><FONT SIZE=2>&gt; Proprietary/Confidential</FONT>
<BR><FONT SIZE=2>&gt; Information belonging to CGI Group Inc. and its</FONT>
<BR><FONT SIZE=2>&gt; affiliates</FONT>
<BR><FONT SIZE=2>&gt; may be contained in this message. If you are not a</FONT>
<BR><FONT SIZE=2>&gt; recipient</FONT>
<BR><FONT SIZE=2>&gt; indicated or intended in this message (or</FONT>
<BR><FONT SIZE=2>&gt; responsible for</FONT>
<BR><FONT SIZE=2>&gt; delivery of this message to such person), or you</FONT>
<BR><FONT SIZE=2>&gt; think for</FONT>
<BR><FONT SIZE=2>&gt; any reason that this message may have been addressed</FONT>
<BR><FONT SIZE=2>&gt; to you</FONT>
<BR><FONT SIZE=2>&gt; in error, you may not use or copy or deliver this</FONT>
<BR><FONT SIZE=2>&gt; message</FONT>
<BR><FONT SIZE=2>&gt; to anyone else.&nbsp; In such case, you should destroy</FONT>
<BR><FONT SIZE=2>&gt; this</FONT>
<BR><FONT SIZE=2>&gt; message and are asked to notify the sender by reply</FONT>
<BR><FONT SIZE=2>&gt; email.</FONT>
<BR><FONT SIZE=2>&gt; </FONT>
</P>


<P><STRONG>*** Confidentiality Notice ***</STRONG> 
Proprietary/Confidential<BR>Information belonging to CGI Group Inc. and its 
affiliates<BR>may be contained in this message. If you are not a 
recipient<BR>indicated or intended in this message (or responsible 
for<BR>delivery of this message to such person), or you think for<BR>any reason 
that this message may have been addressed to you<BR>in error, you may not use or 
copy or deliver this message<BR>to anyone else.&nbsp; In such case, you should 
destroy this<BR>message and are asked to notify the sender by reply 
email.</P>
</BODY>
</HTML>