Thanks to Matthew and the new GUI(s), you don't need this anymore, but in case you want more info:<br><br>Unfortunately, that was quite a pain: I had to maintain a symbolic representation of each attribute of the widget object to (re)instantiate it with the correct arguments, possibly changing the parent.<br>
<br>Quickly: A widget is a mred-id% object, and its property%s are its symbolic representation.<br>To create a new mred-id% with a different parent, it is instantiated by a widget mred-plugin%, given the values of the property%s.<br>
<br>Another potentially interesting (but separate) thing is the code-write<%> interface, that can "serialize" objects (with less restrictions than the default existing serializer, unless I am mistaken) to constructor code (to save it to a file, and load it later).<br>
If you want more info, take a look at "code-write.ss" in the code and in the docs :<br>- <a href="http://planet.plt-scheme.org/package-source/orseau/mred-designer.plt/3/7/code-write.ss">http://planet.plt-scheme.org/package-source/orseau/mred-designer.plt/3/7/code-write.ss</a><br>
- <a href="http://mred-designer.origo.ethz.ch/wiki/developer_doc">http://mred-designer.origo.ethz.ch/wiki/developer_doc</a><br>It mainly provides a code-write<%> interface that is probably similar to your deep-copy<%> one.<br>
Then you only need to declare the fields that you want serialized and call `code-write-value'.<br>The serialization procedure can also be overriden if necessary. <br>And It can be used for any classes, not just widgets.<br>
<br>Laurent<br><br><br><div class="gmail_quote">On Fri, Jan 21, 2011 at 19:22, Jon Rafkind <span dir="ltr"><<a href="mailto:rafkind@cs.utah.edu">rafkind@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
Can you say more about the serialization required? I found that I
could add a `deep-copy' method that to my gui objects that accepted
the new parent so each object could instantiate itself as needed.<br>
<br>
Maybe all the gui objects in racket could implement some
deep-copy<%> interface?<div><div></div><div class="h5"><br>
<br>
On 01/21/2011 08:07 AM, Laurent wrote:
<blockquote type="cite">Unless it has changed, you have to recreate copies all
children under the new parent, and remove the old ones. MrEd
Designer uses that extensively, but this requires a kind of
serialization of the gui objects.<br>
<br>
Laurent<br>
<br>
<div class="gmail_quote">On Fri, Jan 21, 2011 at 13:09, Robby
Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
No, it isn't possible with the current GUI toolkit to do that.<br>
<font color="#888888"><br>
Robby<br>
</font>
<div>
<div><br>
On Thu, Jan 20, 2011 at 12:34 PM, Jon Rafkind <<a href="mailto:rafkind@cs.utah.edu" target="_blank">rafkind@cs.utah.edu</a>>
wrote:<br>
> Is there a way to change the parent of a gui object?
(anything from the<br>
> framework collection)<br>
> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
><br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a></div>
</div>
</blockquote>
</div>
<br>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br>