[Gambas-user] gb.web.form: Preserve state of dialog window

Tobias Boege taboege at ...626...
Sun Nov 13 18:40:38 CET 2016


On Sun, 13 Nov 2016, Benoît Minisini wrote:
> Le 13/11/2016 à 17:02, Tobias Boege a écrit :
> > On Sun, 13 Nov 2016, Benoît Minisini wrote:
> >> Le 13/11/2016 à 16:11, Benoît Minisini a écrit :
> >>>
> >>> I found another bug: the static instance is not correctly kept between
> >>> requests.
> >>>
> >>> At each request, all GUI object are re-created. But when one of them is
> >>> an automatic static instance, it is recreated as a normal instance.
> >>>
> >>> Regards,
> >>>
> >>
> >> Does it work now for you with revision #7969?
> >>
> >
> > The window is persistent now. Thanks. But if I have a custom property like
> > the Opened As Boolean in the example I attached previously, will it be
> > preserved, too? That seems not to be the case currently (even if I make
> > it a Read/Write property).
> >
> > Of course, I don't need that specific property anymore now, but will other
> > properties added to a Webform class be restored? Since the Tag property is
> > preserved, I can also use that for any additional data, I guess.
> >
> > Regards,
> > Tobi
> >
> 
> You must store the property in the session, and this is not automatic.
> 
> In the property write method, do that:
> 
> Me._SetProperty("<property name>", value)
> 
> Of course, this is not meant to be used outside of 'gb.web.form' at the 
> moment!
> 
> The _SetProperty() method store the value and the name of the property 
> in the session. And that value is automatically restored when objects 
> are re-created when a new request is handled.
> 

Of course! It's been some time since I last worked closely with gb.web.form.
I already use that method in other classes, and _AddJavascript() as well.
Maybe I shouldn't cause so much trouble by using internal mechanisms which
you may break later, but these were very convenient ways to get the job done
when I wrote the project.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list