Hey Janne,
2010/10/15 Janne Rönkkö <[email protected]>:
> I overrided onclick event in the updateDom function. So I would need to
> do some rethinking to get the Wt's clicked signal working again I guess.
> And the element looks like WPushButton.
>
> WAnchrod had something like this:
> element.setAttribute("href", <theurl> )
>
> With the button I could use
> element.setAttribute( "onclick", "window.location = 'url'" )
That is a solution we use now as well, using WApplication::redirect()
from button.clicked() -- your solution simply does it using
client-side JavaScript.
My one objection against it is that it does not work without
JavaScript, so it would need a graceful degradation fall-back
(probably to an anchor ?).
> I did not originally try to define it as specialized anchor but using
> WPushButton with clicked signal connected to a function that was like this:
> {
> Wt::JSlot slot;
> slot.setJavaScript( "function(obj, event) { window.open( '" +
> resource->url() + "' ); }" );
> slot.exec();
> }
I would imagine though that connecting the jslot to button->clicked()
with the following JavaScript is equivalent to your solution ?
"function() { window.location = '" + url + "'; }"
And thus you can implement your button as a specialization of
WPushButton in this way ?
Regards,
koen
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest