Project

General

Profile

Wt new page

Added by Claire Mc almost 5 years ago

Hi everyone,

I have been working on Wt 4.0.5. I would like to open new page by clicking or linking.

Do you have any good solutions?

so far I get stuck how to use setResource().

Thank you

Yokie


Replies (11)

RE: Wt new page - Added by Roel Standaert almost 5 years ago

Hi,

So, are you trying to open a totally different page? Or do you want a new page within your Wt application?

If you want to open some other website in a new page, I think what you're looking for is WAnchor and WLink.

You'll have to set the link's target to NewWindow.

Regards,

Roel

RE: Wt new page - Added by Claire Mc almost 5 years ago

Hi Roel,

First of all Thank you so much for getting back so quickly.

I would like to open new page within my Wt Application. What should I start?

Also Do you have any call back functions example code?

Yokie

RE: Wt new page - Added by Roel Standaert almost 5 years ago

So you want two pages open at the same time in the WApplication? Or do you want your widget tree to change to something else?

The first is not something that Wt can currently do: a WApplication only lives in one single window or browser tab. You'd have to load an entirely new WApplication.

If you just want to effect of navigating to another page of the application: since Wt is a single page application framework, you don't actually load an entirely new page. The concept of pages in Wt is usually simulated by using WStackedWidget (often in combination with a WMenu), and if bookmarking "pages" or linking directly to them is necessary, internalPaths can be used.

Regards,

Roel

RE: Wt new page - Added by Claire Mc almost 5 years ago

Basically, I would like to click the login button from current page then navigate to another page.

Sincerely,

Yokie

RE: Wt new page - Added by Roel Standaert almost 5 years ago

So you want the entire contents to change? You can do that by just clearing the root() container and filling it with new stuff, or by using a WStackedWidget.

RE: Wt new page - Added by Claire Mc almost 5 years ago

Yes but I tried and get stuck. I can't find any examples.

RE: Wt new page - Added by lm at almost 5 years ago

You're going to have to show what you're doing, my friend. Paste your application code at https://paste.ubuntu.com or so; tell us what happens, and what you would like to happen. You can get a lot of help here, but you'll have to ask precise questions :-)

RE: Wt new page - Added by Claire Mc almost 5 years ago

Here is my work.

https://paste.ubuntu.com/p/Mg92FYcrQZ/

Sorry,I'm quite new on Wt.

RE: Wt new page - Added by Roel Standaert almost 5 years ago

Do you want just the contents of the page to change, or also the internal path?

If you just want to change the contents, you can just use clear() (see attachment).

RE: Wt new page - Added by Claire Mc over 4 years ago

Yes, I would Like to change contents and internal path at the same time.

I'm appreciate all your help.

RE: Wt new page - Added by Roel Standaert over 4 years ago

Since Wt is a single page application framework, internal paths don't inherently have a meaning in Wt. There is a signal internalPathChanged() that you can hook into when the internal path changes, and then update the widget tree accordingly, see this example in the widget gallery: https://www.webtoolkit.eu/widgets/navigation/

Do note that when it comes to login you shouldn't just react to internalPathChanged() to navigate to the logged in page, because then users could just bypass login. You'll have to still check whether they're logged in.

    (1-11/11)