Re: [PW-dev] Static methods - was Widget factory
Status: Alpha
Brought to you by:
spadkins
From: Stephen A. <ste...@of...> - 2001-06-12 11:19:38
|
At 09:49 AM 6/12/2001 +0200, you wrote: >> At 05:08 PM 6/11/2001 -0500, you wrote: >> >"Jay Lawrence" <Ja...@La...> wrote: ... >> Thus, both the Widget package and Widget::Controller objects are acting as >> factories >> in the PWL. >> >> Stephen > >Wait a second... I was under the impression that the Widget::COntroller >object simply got "bound" to a top level Widget object somewhere... That >you couldn't actually go about creating the actual Widgets until you had an >instantiated Controller.... Am I barking up wrong trees here??? > > Issac The Widget::Controller is a controller, not a widget. For more info on what a "controller" is, please see the FAQ. http://www.officevision.com/pub/Widget/FAQ.html The API is currently set up to require you to instantiate a Controller before you can successfully instantiate any widgets because it is through the Controller that you have access to configuration and state information. If one of the desired usage variants is to instantiate widgets *directly*, there would need to be a default global Controller created. This brings us back to our Teambuilding Exercise #2: Usage ... Q. Do we need to be able to do the following? (I think this is what Jay is implying.) use Widget::HTML::Button; $button = Widget::HTML::Button->new ( -name => "fetch", -bgcolor => "#ff0000", ); I had intended that this *not* be valid usage because of the globals it would require. Rather that all widgets be instantiated via the Controller like so. use Widget; $wc = Widget->controller(); $button = $wc->widget ( -name => "fetch", '-widget-class' => "Widget::HTML::Button", -bgcolor => "#ff0000", ); Stephen |