Re: [PW-dev] Freezing and Thawing widgets
Status: Alpha
Brought to you by:
spadkins
From: <ja...@la...> - 2001-06-11 18:10:26
|
Bingo! I suggest that a widget contain a list of properties to be saved when frozen and to be recalled when thawing. @freeze_props=qw(fname size width colour shape foo bar); Other properties will no doubt exist for any given widget but only the above actually get frozen or thawed. Cheers, J On Mon, 11 June 2001, James G Smith wrote: > > "Jay Lawrence" <Ja...@La...> wrote: > >From: "Gunther Birznieks" <gu...@ex...> > >> How do you propose supporting this API-wise? > > > >$stored_data = $widget->freeze; > > Sounds good to me. > > >This should return a data structure (i.e. hash) in a format like Storable or > >Data::Dumper of all of the properties of the object that are persistant. I > >don't belive that you can just freeze or thaw your runtime object as it > >might have extra information that is not suitable for storing. (ie/ object > >ref to controller object, etc). Not to mention it is implementation > >specific - and if you change your implementation your frozen objects won't > >be as easy to recall. > > The frozen widget should only contain data specific to the widget and not any > state information, since that may change before it is thawed out. Makes sense > to have the function be in the widget. I'll put a freeze method in my > Widget::Base before putting it up so people can see how it might work (at > least my way of doing it :/). > > >My idea to get this data back might be as follows: > > > >$widget=Widget->new( thaw => $stored_data ); > > # Will know what class this object is from contents of $stored_data > >or > >$widget=new Widget::Foo; > >$widget->thaw( $stored_data ); > > # Gotta check that stored_data widget class matches this widget class, > >eh? > > Perhaps also: > > $widget = Widget -> thaw($stored_data); ? > > I'll try to stick that into my Widget::Controller package as well. > -- > James Smith <JG...@TA...>, 979-862-3725 > Texas A&M CIS Operating Systems Group, Unix > > > > _______________________________________________ > Perl-widget-developer mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-widget-developer |