Project

General

Profile

How do I create a new page?

Added by Matt Picas about 8 years ago

Hi can anyone help me create a new page? I am running everything out of a container called *parent and have images that I want to link to a new page. I've been at it all day but I haven't be able to figure out how to get everything to load into a separate page. Basically I just want to get a new page with new images without displaying anything from the previous container as simple as possible (under a separate base path). Does anyone know the best way for me to do that?


Replies (5)

RE: How do I create a new page? - Added by Matt Picas about 8 years ago

Been trying for about 12 hours straight, I tried to achieve what I'm after by creating a stacked widget in the *parent container and then making a menu (which seems right since if it worked it would load only 1 instance at a time) but I'm not sure how to load a container (which I guess would have to be from another file to work). I tried with the following lines of code:

DragExample::DragExample(WContainerWidget *parent):
  WContainerWidget(parent)
{

   // That which enables single instances of the application and the switching between them
   WStackedWidget *contents = new WStackedWidget();



   // That which would hold clickable text if I allowed it and that will create the deploy paths to hold the instances of the application
   WMenu *menu = new WMenu(contents, Vertical, this);


   // Internal Base Path Enabled to / in the url
   menu->setInternalPathEnabled();
   menu->setInternalBasePath("/");

   // Loads the file that contains the container hopefully  **TEMPORARILY BROKEN AS UNDER MAINTENANCE)
  // menu->addItem("Home", new mainpage());


   // Not sure what the exact purpose is, but it provides a link between contents and the parent container of the project
   this->addWidget(contents);

I tried to create something for it to read off of but I am a bit lost on how, I made a separate file called mainpage.cpp and put this in there:

#ifndef MAINPAGE_H_
#define MAINPAGE_H_

/// Class demonstrating drag and drop in Wt
class mainpage: public Wt::WContainerWidget
{
 public:
  mainpage(Wt::WContainerWidget *mainpage);
};

#endif

mainpage::mainpage(WContainerWidget *mainpage):
  WContainerWidget(mainpage)
{

  Wt::WImage *image = new Wt::WImage(Wt::WLink("logos/DOTA2Logo.jpg"),
                                   this);
  image->setMargin(5, Wt::Left);
}

I'm probably way off the mark so if anyone can please help me it means everything to me! I am lost

RE: How do I create a new page? - Added by Matt Picas about 8 years ago

Matt Picas wrote:

Been trying for about 12 hours straight, I tried to achieve what I'm after by creating a stacked widget in the *parent container and then making a menu (which seems right since if it worked it would load only 1 instance at a time) but I'm not sure how to load a container (which I guess would have to be from another file to work). I tried with the following lines of code:

DragExample::DragExample(WContainerWidget *parent):

WContainerWidget(parent)

{

// That which enables single instances of the application and the switching between them

WStackedWidget *contents = new WStackedWidget();

// That which would hold clickable text if I allowed it and that will create the deploy paths to hold the instances of the application

WMenu *menu = new WMenu(contents, Vertical, this);

// Internal Base Path Enabled to / in the url

menu->setInternalPathEnabled();

menu->setInternalBasePath("/");

// Loads the file that contains the container hopefully **TEMPORARILY BROKEN AS UNDER MAINTENANCE)

// menu->addItem("Home", new mainpage());

// Not sure what the exact purpose is, but it provides a link between contents and the parent container of the project

this->addWidget(contents);

I tried to create something for it to read off of but I am a bit lost on how, I made a separate file called mainpage.cpp and put this in there:

#ifndef MAINPAGE_H_

#define MAINPAGE_H_

/// Class demonstrating drag and drop in Wt

class mainpage: public Wt::WContainerWidget

{

public:

mainpage(Wt::WContainerWidget *mainpage);

};

#endif

mainpage::mainpage(WContainerWidget *mainpage):

WContainerWidget(mainpage)

{

Wt::WImage *image = new Wt::WImage(Wt::WLink("logos/MyTestPic.jpg"),

this);

image->setMargin(5, Wt::Left);

}

I'm probably way off the mark so if anyone can please help me it means everything to me! I am lost

RE: How do I create a new page? - Added by Matt Picas about 8 years ago

Been trying for about 12 hours straight, I tried to achieve what I'm after by creating a stacked widget in the *parent container and then making a menu (which seems right since if it worked it would load only 1 instance at a time) but I'm not sure how to load a container (which I guess would have to be from another file to work). I tried with the following lines of code:

DragExample::DragExample(WContainerWidget *parent):

WContainerWidget(parent)

{

// That which enables single instances of the application and the switching between them

WStackedWidget *contents = new WStackedWidget();

// That which would hold clickable text if I allowed it and that will create the deploy paths to hold the instances of the application

WMenu *menu = new WMenu(contents, Vertical, this);

// Internal Base Path Enabled to / in the url

menu->setInternalPathEnabled();

menu->setInternalBasePath("/");

// Loads the file that contains the container hopefully **TEMPORARILY BROKEN AS UNDER MAINTENANCE)

// menu->addItem("Home", new mainpage());

// Not sure what the exact purpose is, but it provides a link between contents and the parent container of the project

this->addWidget(contents);

I tried to create something for it to read off of but I am a bit lost on how, I made a separate file called mainpage.cpp and put this in there:

#ifndef MAINPAGE_H_

#define MAINPAGE_H_

/// Class demonstrating drag and drop in Wt

class mainpage: public Wt::WContainerWidget

{

public:

mainpage(Wt::WContainerWidget *mainpage);

};

#endif

mainpage::mainpage(WContainerWidget *mainpage):

WContainerWidget(mainpage)

{

Wt::WImage *image = new Wt::WImage(Wt::WLink("logos/MyTestPic.jpg"),

this);

image->setMargin(5, Wt::Left);

}

I'm probably way off the mark so if anyone can please help me it means everything to me! I am lost

RE: How do I create a new page? - Added by Matt Picas about 8 years ago

Sorry I mistook the quote button for edit, I was trying to fix something but messed up big time! Won't happen again

RE: How do I create a new page? - Added by Koen Deforche about 8 years ago

Hey Matt,

I'm not entirely sure what you want: do you want the images to be a link to a new page? Thus clicking the image switches to a new page?

Can you describe more clearly what you are trying to build?

Koen

    (1-5/5)