On Thu, Jul 1, 2010 at 2:28 AM, omer katz <[email protected]> wrote:
>
>
> 2010/6/29 Koen Deforche <[email protected]>
>>
>> Hey Omer,
>>
>> 2010/6/2 omer katz <[email protected]>:
>> >
>> > Hello,
>> > I had been thinking about a way to automate even more the process of
>> > creating user interfaces in Wt.
>> > If we could define widgets on the XML file like this for example:
>> >>
>> >> <Widget type="WTextEdit" name="foo" value="bar" />
>> >
>> > It would make development of user interfaces much easier and even
>> > cheaper as
>> > regular web developers could just do it themselves.
>> > It will also allow us to create the Wt Creator much more easily.
>>
>> Aside from conerns with syntax, I cannot but agree with the idea. This
>> syntax is in fact the initial syntax I used for WTemplate, but mixing
>> XHTML tags with new invented tags makes it hard to easily spot the
>> variables in a template -- and this is why I changed from <WWidget ...
>> > to ${ } syntax.
>>
>> Still, the XML approach may be more appropriate in this case,
>> especially if you consider that a widget may contain other widgets.
>
>
> I suppose that RapidXML supports querying for a certain XML tag.
> So it's not trouble there.
> You just GetElementByTagName("Widget") and read the attributes for each one.
> I am suggesting a compile time tool since I wouldn't like the user to
> specify the needed type within the code itself as well.
> I was a Loki developer. Of course I know traits.
> The problem is that if we are parsing the type and are creating a new one,
> the type will have to be deducted on runtime.
> I thought about refactoring WidgetMap to contain empty widgets which will be
> cloned but adding each existing widget is a nightmare.
> Unfortunately C++ lacks reflection so we're stuck here with either a compile
> time tool or some factory that can map strings to objects.

Could always create/add a scheme/lisp/etc... interpreter (Boost.Spirit
created one as a new example recently, not done yet though), that
would let you create the definition files like this, and they could be
properly mapped, executed, and so forth:
  (Widget :type "Slider" :name "foo" :value "bar"
    (Event :name "ValueChanged" :language "JavaScript"
      function handler(value) { alert (value); }
    )
  )
And since it is a full interpreter, it could run code as well (the
above may look like a definition file, but it is actually code, and as
such can still run arbitrary code).

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to