RE: Problem with using WComboBox and Binding WAudio ยป problemCode.cpp
1 |
#include <Wt/WApplication>
|
---|---|
2 |
#include <Wt/WAudio>
|
3 |
#include <Wt/WComboBox>
|
4 |
|
5 |
class App : public Wt::WApplication |
6 |
{
|
7 |
public:
|
8 |
App(const Wt::WEnvironment& env) : Wt::WApplication(env) |
9 |
{
|
10 |
Wt::WAudio *audio = new Wt::WAudio(root()); |
11 |
audio->setId("audio0"); |
12 |
|
13 |
Wt::WComboBox* cb = new Wt::WComboBox(root()); |
14 |
cb->addItem("1"); |
15 |
cb->addItem("2"); |
16 |
cb->addItem("3"); |
17 |
cb->setCurrentIndex(0); |
18 |
cb->activated().connect(this, &App::appDoSomething); |
19 |
}
|
20 |
|
21 |
void appDoSomething() |
22 |
{
|
23 |
new Wt::WComboBox(Wt::WApplication::instance()->root()); |
24 |
}
|
25 |
};
|
26 |
|
27 |
|
28 |
Wt::WApplication* CreateApp(const Wt::WEnvironment& env) |
29 |
{
|
30 |
return new App(env); |
31 |
}
|
32 |
|
33 |
|
34 |
int main(int argc, char* argv[]) |
35 |
{
|
36 |
return Wt::WRun(argc, argv, CreateApp); |
37 |
}
|