I am using the Wt library to write in C++ a website. I would like to use tabs on that website. To do so I use the WTabWidget
.
In the documentation they make a tab and link each tab to a function :
Wt::WTabWidget *examples = new Wt::WTabWidget(this);
examples->addTab(helloWorldExample(), "Hello World");
examples->addTab(chartExample(), "Charts");
examples->addTab(new Wt::WText("A WText"), "WText");
Based on that I wrote this :
WTabWidget *myTab = new WTabWidget();
myTab->addTab(test(), "Test Tab");
But my compiler tells me :
error: cannot initialize a parameter of type 'Wt::WWidget *' with an rvalue of type 'void'
My "test" function has return type void. It's logic an rvalue of type void cannot be assigned to a parameter of type "WWidget*".
But if they show that example in the documentation, why can't I do it?
that : examples->addTab(chartExample(), "Charts");
Thanks for your help!
But if they show that example in the documentation, why can't I do it?
Their example function returns a widget, so you should do the same:
Wt::WWidget* test()
{
Wt::WText *text = new Wt::WText("This is a test tab text");
return text;
}