Sure go nuts, DisplayObject exposes all visual children, you can create any
kind of decorator you want really, although it'll have to understand the
internals of anything you want to decorate. Obviously the component and
skinning model could have been better, that's why it's different in Gumbo.
Not much point complaining that it's not perfect, we know ;-)

-Josh

On Fri, Sep 12, 2008 at 1:02 PM, wnoone01 <[EMAIL PROTECTED]> wrote:

> Hey all,
>
> Thanks for the responses. I just want to clarify my question a little
> bit. I am not particularly interested in the actual solution to the
> example. Although, it is the actual problem that prompted me to ask
> the question in the first place. And:
>
> Alex: My solution will most likely group both multiline and html in one
> Doug:  I haved looked into using CanvasButton for this (and may still
> use it)
>
> Its just that my issue here is more general.
>
> Let's say I go with CanvasButton as the solution. I still need to
> support CanvasButton functionality in RadioButton and CheckBox. That
> requires suclasses:
>
> CanvasRadioButton
> CanvasCheckBox
>
> Maybe this is the only way to go, but I was hoping there was a
> strategy that was more elegant.  For example, writing a CanvasRenderer
> class and then "snapping on" to button or subclasses as needed.
> Something very similar to item renderers.
>
> Or maybe something else (decorator pattern, composition)?
>
> ---
>
> Maybe I am just frustrated with the implementation of Button. It just
> seems the visual UI is too tightly coupled with the behavior.
>
>
>
> --- In [email protected], "Doug McCune" <[EMAIL PROTECTED]> wrote:
> >
> > heh, that's almost the exact description of what I called the
> > "CanvasButton":
> >
>
> http://dougmccune.com/blog/2007/06/01/new-component-canvasbutton-added-to-flexlib/
> >
> > Doug
> >
> > On Thu, Sep 11, 2008 at 3:22 PM, Josh McDonald <[EMAIL PROTECTED]> wrote:
> >
> > >   Yeah, I'd make one subclass of Button that lets you put whatever you
> > > please as the label, and have "function set labelControl(cntrl:*)"
> as the
> > > [DefaultProperty]. If it finds a string, go with a UITextField, if
> it's a
> > > DisplayObject, use it, if not throw an error. Then you have:
> > >
> > > <pkg:FreeFormButton click="doStuff" width="150">
> > >   <mx:text>blah blah blah blah blah blah blah blah blah</mx:text>
> > > </pkg:FreeFormButton>
> > >
> > > -Josh
> > >
> > >
> > > On Fri, Sep 12, 2008 at 8:04 AM, Alex Harui <[EMAIL PROTECTED]> wrote:
> > >
> > >>  Make one subclass that handles both HTML and multiline?
> > >>
> > >>
> > >>
> > >> *From:* [email protected]
> [mailto:[EMAIL PROTECTED] *On
> > >> Behalf Of *wnoone01
> > >> *Sent:* Thursday, September 11, 2008 11:17 AM
> > >> *To:* [email protected]
> > >> *Subject:* [flexcoders] Subclassing Components: Theoretical Question
> > >>
> > >>
> > >>
> > >> Hey all,
> > >> I've got a theoretical question about subclassing a component.
> Here is
> > >> the use case:
> > >>
> > >> A programmer requires buttons that support multiline labels. This
> is a
> > >> requiement for Button, RadioButton, and CheckBox. Now to start, the
> > >> programmer can subclass mx.controls.Button to implement the
> > >> functionality. But now he needs to implement the functionality in
> > >> RadioButton and CheckBox.
> > >>
> > >> One way is to subclass RadioButton and CheckBox and then
> duplicate the
> > >> functionality there. However, not only will he be duplicating
> > >> functionality, he is headed down a slippery slope. Let's say that for
> > >> his next project, he suddenly requires a button label that supports
> > >> HTML formatting. Now he must subclass again. So now the classes grow
> > >> from:
> > >>
> > >> MultilineButton
> > >> MultilineRadioButton
> > >> MultilineCheckBox
> > >>
> > >> To
> > >>
> > >> MultilineButton
> > >> HTMLButton
> > >> MultilineRadioButton
> > >> HTMLRadioButton
> > >> MultilineCheckBox
> > >> HTMLCheckBox
> > >>
> > >> The next project requires a multiline html button. So now its:
> > >>
> > >> MultilineButton
> > >> HTMLButton
> > >> MultilineHTMLButton
> > >> MultilineRadioButton
> > >> HTMLRadioButton
> > >> MultilineHTMLRadioButton
> > >> MultilineCheckBox
> > >> HTMLCheckBox
> > >> MultilineHTMLCheckBox
> > >>
> > >> And now its officially out of hand and the programmer is mired in a
> > >> subclassing nightmare.
> > >>
> > >> ---
> > >>
> > >> So basically my question is what is the best way to handle this
> > >> problem in Flex. Is subclassing the only way or is there a more
> > >> efficient solution (decorators, item renderers, etc.)?
> > >>
> > >> Thanks in advance for any guidance
> > >> Bill
> > >>
> > >>
> > >
> > >
> > > --
> > > "Therefore, send not to know For whom the bell tolls. It tolls for
> thee."
> > >
> > > http://flex.joshmcdonald.info/
> > >
> > > :: Josh 'G-Funk' McDonald
> > > :: 0437 221 380 :: [EMAIL PROTECTED]
> > >
> > >
> >
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to