Markus,

There are two possiblities to do this:
1. Use a WAnchor. What did not work? Can you be more specific? An
anchor does not redirect, but lets the browser load the specified page
directly (you can use WAnchor::setTarget() to open the link in a new
window)
2. Use WApplication::redirect. With this method, you can decide at the
server side to perform a redirect. Note that you don't have to derive
from the WApplication object in order to call its methods; the global
variable 'wApp' always contains a reference to the current
application. wApp is in fact a define that makes sure that your thread
gets the right WApplication object for your session; you can also use
WApplication::instance(). So your slot method may look like this:

void MyClass::buttonPressed()
{
  wApp->redirect("http://www.webtoolkit.eu/";);
}

And like zhimin suggests, there's a third option, being to manually
write your anchors. IIRC you don't even have to put them in XML, as
anchors are not filtered by the XSS filter.

Regards,
Wim.

2009/6/22 [email protected] <[email protected]>:
> Hi,
>
> currently I have some trouble using WPushButton class, which is used
> inside a WContainerWidget derived class. So the exercise is to redirect
> to an external website, when the WPushButton got clicked. How do I solve
> this problem?
> I tried to use WAnchor but it did not work. The redirect method only
> exists in WApplication (and derived classes) which isnt. Any proposal?
> Thank you very much for you help in the past,
>
> Best regards
>
> Markus
>

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to