Project

General

Profile

RE: Internet Explorer goes to back of window stack when I... ยป main.cpp

Steve Drake, 04/10/2013 03:36 PM

 
//============================================================================
// Test case: opening this web app in Internet Explorer 9 causes the IE window
// to 'recede' behind any other open windows on the desktop.
//
// Steps:
// - Build the app
// - Start it
// - Open web app in Internet Explorer 9 browser
//
// Results:
// - The IE web browser window 'recedes' so that it is the furthest in the
// background of any other windows on the desktop.
//
// Notes:
// - The web app was built and executed on Ubuntu 10.04
// - Wt version 3.2.1 was used
// - Internet Explorer version 9.0.8.8112.16421, running on Windows 7
// - If there is a second tab open in IE then the problem does not occur.
// - Once the web app is running, you can press F5 to refresh the IE
// window and the problem will also occur.
//============================================================================

#include <Wt/WApplication>
#include <Wt/WDialog>
#include <Wt/WString>
#include <Wt/WText>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>

class MyDialog : public Wt::WDialog
{
public:
MyDialog(const Wt::WString &windowTitle);
~MyDialog();
Wt::WLineEdit* edit;
Wt::WPushButton* button;
};

MyDialog::MyDialog(const Wt::WString &windowTitle) : Wt::WDialog(windowTitle)
{
contents()->addWidget(new Wt::WText(Wt::WString("Enter some text:")));
edit = new Wt::WLineEdit();
contents()->addWidget(edit);
button = new Wt::WPushButton(Wt::WString("Push the button"));
contents()->addWidget(button);
}

MyDialog::~MyDialog()
{
}

class MyApplication : public Wt::WApplication
{
public:
MyApplication(const Wt::WEnvironment& env);
~MyApplication();
MyDialog* dialog;
void createUi();
void buttonClickedHandler(void);
int count;
};

MyApplication::MyApplication(const Wt::WEnvironment& env) :
Wt::WApplication(env), count(0)
{
createUi();
}

MyApplication::~MyApplication()
{
delete dialog;
}

void MyApplication::createUi()
{
dialog = new MyDialog(Wt::WString("Dialog title"));
dialog->button->clicked().connect(this,
&MyApplication::buttonClickedHandler);

dialog->show();
}

void MyApplication::buttonClickedHandler(void)
{
dialog->button->setText(Wt::WString("push it again"));

count++;
char numText[32];
snprintf(numText, sizeof(numText), "%d", count);

dialog->edit->setText(Wt::WString(numText));
}

Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
MyApplication* myApp;

myApp = new MyApplication(env);

return myApp;
}

int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, &createApplication);
}

    (1-1/1)