Hey Brad, 2008/8/12 Brad <[EMAIL PROTECTED]>: > I have a witty app. which is designed to use cascading WTabWidgets (2 > levels deep at the moment), it looks similar to the layout in the witty > class reference. Each tab represents an "applet", usually a form. As I > change from tab to tab my applets remember state which is great but at > certain points, typically after a form submit, I would like to reset the > applet on the next view, not immediately. > > What i am currently doing is this, in each applet class I have a signal > called "invalid" which I emit when I want the applet reset. Then in the > class that holds the WTabWidget I respond to the signal by setting a > field in a bitset to false/0 (the bitset reflecting the validity of the > applets). In a member function that is called when > WTabWidget::currentChanged is emitted I use the index parameter to check > whether the corrresponding applet needs to be reset and respond > accordingly. If I do reset the applet I clear() the container and then > add a new copy of my class and reconnect the invalid signal. > > I hope this is all clear and I would appreciate any feedback anyone can > give me on whether I am barking up the wrong tree.
I think this strategy is entirely fine! In a project with a similar need, we connected the ::currentChanged signal to a slot that calls a refresh() method of the corresponding widget. We then reimplemented this method for each widget to allow it to update itself in any way it wants. So I guess that is a similar solution. Your solution is cleaner since the WWidget::refresh() method also refreshes all strings to update themselves from the message resource bundles, which is not necessarily necessary. > I'd like to say again that I am really enjoying working with witty and I > am learning a lot fast :) Good to hear! Regards, koen ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest