[Mono-devel-list] Serializing widgets with C#
lists at ophion.org
Mon Aug 1 08:45:57 EDT 2005
Alfredo Jose Muela Romero wrote:
>El Sun, 31 Jul 2005 17:48:21 -0700
>Rafael Ferreira <lists at ophion.org> escribió:
>>Crazy question but can you explain to me why would you want to do
> The point is that I'm developing a program in which the GUI is
>generated dinamically (i.e. widgets come and go with the user
>interaction) so one of my business classes contains an array of
>Gtk.Widgets (the ones which are added to the interface). So, somehow, I
>need to keep this info for the next restarting of the program (in order
>to keep the interface as the user wanted before stopping the program).
>At this point the choices were:
> 1) Back-up the object at a OODB
> 2) Back-up the data at tables in a RDB
> 3) Make a config file where I put the needed info to reconstruct the
>objects (with the widgets) at starting time
> 4) Serialize the objects before stopping the program and deserialize
>them at starting.
> And, well, you know my choice.
> Any suggestions and/or advices will be welcomed.
>>On Sun, 2005-07-31 at 19:46 +0200, Alfredo Jose Muela Romero wrote:
>>> Hi everybody,
>>> I'm new to this list, I have look up the answer to my question
>>>the list's files but I haven't found it so I'll make it: how can I
>>>make it to serialize an object which contains an array of
>>>Gtk.Widgets since for serializing I need to mark the classes with
>>>[Serializable]? In other words, how can I serialize an object with
>>>3rd party objects whithin?
>>> Thanks in advance,
>>>Mono-devel-list mailing list
>>>Mono-devel-list at lists.ximian.com
>>Mono-devel-list mailing list
>>Mono-devel-list at lists.ximian.com
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
What you're trying to accomplish is impossible. first because gtk
widgets are not serializable and secondly, it just sounds like a bad
idea all together :-). In order for you to serialize an array of
anything the entire object graph needs to be serializable, so if you
wrap a gtk widget in a class that is ISerializable, it will still fail
since the widget isn't.
I suggest you look into Monodevelop's settings code to get a sense of
how MD is persisting the user UI preferences and reconfiguring it at
my 2 cents,
More information about the Mono-devel-list