[racket] reparent gui object

From: Laurent (laurent.orseau at gmail.com)
Date: Sat Jan 22 08:55:57 EST 2011

Thanks to Matthew and the new GUI(s), you don't need this anymore, but in
case you want more info:

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.

Quickly: A widget is a mred-id% object, and its property%s are its symbolic
representation.
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.

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).
If you want more info, take a look at "code-write.ss" in the code and in the
docs :
-
http://planet.plt-scheme.org/package-source/orseau/mred-designer.plt/3/7/code-write.ss
- http://mred-designer.origo.ethz.ch/wiki/developer_doc
It mainly provides a code-write<%> interface that is probably similar to
your deep-copy<%> one.
Then you only need to declare the fields that you want serialized and call
`code-write-value'.
The serialization procedure can also be overriden if necessary.
And It can be used for any classes, not just widgets.

Laurent


On Fri, Jan 21, 2011 at 19:22, Jon Rafkind <rafkind at cs.utah.edu> wrote:

>  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.
>
> Maybe all the gui objects in racket could implement some deep-copy<%>
> interface?
>
>
> On 01/21/2011 08:07 AM, Laurent wrote:
>
> 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.
>
> Laurent
>
> On Fri, Jan 21, 2011 at 13:09, Robby Findler <robby at eecs.northwestern.edu>wrote:
>
>> No, it isn't possible with the current GUI toolkit to do that.
>>
>> Robby
>>
>> On Thu, Jan 20, 2011 at 12:34 PM, Jon Rafkind <rafkind at cs.utah.edu>
>> wrote:
>> > Is there a way to change the parent of a gui object? (anything from the
>> > framework collection)
>> > _________________________________________________
>> >  For list-related administrative tasks:
>> >  http://lists.racket-lang.org/listinfo/users
>> >
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110122/ea396bc5/attachment.html>

Posted on the users mailing list.