2006/12/15, Norbert Hartl <norbert(a)hartl.name>me>:
On Fri, 2006-12-15 at 17:40 +0100, Philippe
Marschall wrote:
2006/12/15, Norbert Hartl
<norbert(a)hartl.name>me>:
On Wed, 2006-12-13 at 18:40 +0100, Philippe
Marschall wrote:
> 2006/12/13, Norbert Hartl <norbert(a)hartl.name>me>:
> > Hi,
> >
> > I'm playing with custom views in Magritte. I have a model
> > and overwrote descriptionContainer with my own instance of
> > MAComponentRenderer.
> >
> > What I'm trying to achieve is to display a text input the
> > following:
> >
> > <label for="anyid">labeltext</label>
> > <input type="text" id="anyid"..../>
> >
> > As a quick test I changed the renderLabel: to
> >
> > renderLabel: aDescription
> > aDescription hasLabel
> > ifTrue: [ html
> > label attributeAt: 'for' put: aDescription hash;
> > with: [ html render: aDescription label ] ]
> >
> > I need an id attribute in the <input> tag which has the
> > same content as the for attribute in the <label> tag.
> > I don't have a glue how to insert an id attribute to the
> > renderControl:. Is there a way to add an attribute if I only
> > have a component. I doubt the component description is the
> > right place to put.
> >
> > If I only want to change the behaviour of the text input field,
> > is it best to overwrite the visitStringDescription?
> >
> > thanks in advance,
>
> This is something that crossed my mind too. To get an id you can use
> something like this:
> (component childAt: aDescription) ajaxId
>
> Now for the rendering of input tags. I see no way other than changing
> or subclassing all the renderer classes.
> MAMultiselectListComponent
> MASelectListComponent
> MATextInputComponent
> MATextAreaComponent
> MARadioGroupComponent
> MARangeComponent
> MATextPasswordComponent
> MAFileUploadComponent
> and whatever I forgot
>
> Honestly I think changing is better because I think it makes sense to
> have this as default behavior.
>
I'm not sure what to change. The only way I see is to have writable
attributes in MAComponent. While the attributes in the MADescription
are class side attributes they could initialize the object attributes
of a MAComponent when the component is created. Okay I'm not that of
an experienced smalltalker but it doesn't sound very good to me, too :)
What do you think?
Have a look at: Magritte-Seaside-pmm.206.
It implements it for some elements. It needs a bit of cleanup, it is
not complete and has some rough edges.
Hmmm, I had a quick peek at the code. I couldn't look at the changes.
I'm getting a weird error from monticello. But I guess the changes
are the labelId and the hasLabelId, right?
Not directly more the changes in MA*Component.
That is a solution for the
problem of setting an id. But what to do if you like to change an other
attribute, let's say the class of an component? Is there a better
approach for other attributes?
Actually yes. You can set #attributes of to an description to an
instance of WAHtmlAttributes. I don't see a need to do this for
classes since the existing markup is so fine grained you should be
able to select anything you want.
This paragraph I don't understand. Can you explain it once more, please?
thanks,
Norbert