Daniel,
First off, are you trying to define a widget to solve a real problem, or
just as a learning exercise? If a real problem, you should know that
generally it's best to just combine some available widgets in a container
widget to achieve what you are looking for. This is called composition -
it's simpler, far less code you have to write, easier to change, and not
much less efficient in the DOM.

Having said that, if you are trying to learn how to make a widget, you
should post some example code of what you think is your best attempt so
folks have something concrete to comment on. And yes, generally derive from
Widget, unless there is an existing widget that is almost what you want.

As for your question about adding DOM elements, you want to use something
like DOM.appendChild()

Rich



On Mon, Jun 18, 2012 at 5:44 PM, Daniel Gonzalez <gonva...@gmail.com> wrote:

> Hi,
>
> I am trying to define my first simple widget, but I am not suceeding.What
> I am trying to define is a widget for a Label/Value pair. Label and Value
> must have configurable style names, so that text size, color, etc can be
> defined independently in the CSS. And they must be horizontally next to
> each other, with label placed before value.
>
> I have tried several implementation without success. It is not clear for
> me from which base class I should derive my widget. Directly from Widget?
> My first idea was to use two different DIVs, one for label and one for
> value, but I do not know how to add two DOM elements to a widget.
>
> Thanks for your help,
> Daniel Gonzalez
>

Reply via email to