[Cosmo-dev] Getting a handle on specific UI elements
Bobby Rullo
br at osafoundation.org
Fri Dec 8 10:02:38 PST 2006
On Dec 8, 2006, at 9:52 AM, Travis Vachon wrote:
>>
>>
>> My idea is fairly simple: give id's to all widgets/UI elements in
>> a consistent, namespaced way, eg "detailPanel.CancelButton"
> +1
>
> This is very easy to implement in our widget code, and really only
> requires developers to make sure they're careful to provide a
> widgetId whenever they create a widget, which they should anyway.
>
> To make sure subwidgets get the correct ids, developers could
> either be diligent to make them of the form "$
> {this.widgetId}.awesomeButton" OR we could put a little logic in
> that finds the parent widget.
>
> Personally, I actually like option 1 better. For a little extra
> work at the time developers write widget creation code/templates,
> ids are more explicit in our code/templates, and we don't lose the
> flexibility to set widgetIds to whatever we want.
Yeah, I don't think we should get too clever about figuring out the
parent widget or whatever, my reasoning is that if you change the
implementation (maybe have a different widget hierarchy or something)
your id's all change, even though nothing changed to the user. And
then Adam comes over complaining.
If you just have a String set, you set it once and forget about it
forever.
Btw - I am 99% sure that if you give something a widget id, that also
becomes the DOM id.
bobby
More information about the cosmo-dev
mailing list