Project

General

Profile

WDialog not positioning correctly

Added by Aleksander Fular almost 11 years ago

I was succesful in putting AuthWidget inside WDialog.

That was a bit of a problem until I came across your example auth2 (thanks for that one ) - However I found out that your solution seemed a bit like a workaround I followed it.

Anyway but to the question:

I am having following problem with WDialog now:

Whenever I open the Dialog for the first time It looks like this:

http://i.imgur.com/kTxP5u8l.png

If i press alt or resize page in anyway it fixes itself

http://i.imgur.com/QMa3JPJl.png

Its only happening for the first time I am opening the Dialog

is there anything I am missing? here is the code I am using for dialog creation

@

logonDialog_ = new Wt::WDialog();

Auth::AuthWidget* authWidget = new Auth::AuthWidget(dbSession_);

authWidget->getCloseRequestSignal().connect(logonDialog_,&Wt::WDialog::accept);

logonDialog_contents()>addWidget(authWidget);

logonDialog_->finished().connect(this, &Logon::dialogDone);

logonDialog_->show();

@


Replies (4)

RE: WDialog not positioning correctly - Added by Koen Deforche almost 11 years ago

Hey,

That definitely looks like a bug. It's probably important to know exactly when you show the dialog (at start up, or when a user pressed a button?)

Can you isolate this misbehaviour in a small test case?

Koen

RE: WDialog not positioning correctly - Added by Aleksander Fular almost 11 years ago

Hello,

I took code from features/auth1 example and slightly modified it.

Added function showDialog and moved there code which created authWidget. the function is called upon pressing a button

@

Wt::WPushButton *showDialogButton = new Wt::WPushButton("show dialog", root());

showDialogButton->clicked().connect(this,&AuthApplication::showDialog);

@

show dialog function:

@

void showDialog() {

Wt::WDialog *dialog = new Wt::WDialog();

Wt::Auth::AuthWidget *authWidget

= new Wt::Auth::AuthWidget(Session::auth(), session_.users(),

session_.login());

authWidget~~model()>addPasswordAuth(&Session::passwordAuth());

authWidget
model()>addOAuth(Session::oAuth());

authWidget->setRegistrationEnabled(true);

authWidget->processEnvironment();

dialog
contents()~~>addWidget(authWidget);

dialog->show();

}

@

I used standard resources.

Copy of code and resources directory are compressed in attachmenet.

In my current code I decided to hardcode values to which WDialog should resize.

@

logonDialog_->resize("675px", "333px");

@

I am developing on windows, and these are my arguments

@

---http-address=0.0.0.0 ---http-port=8181 ---deploy-path=/hello ---docroot=${workspace_loc:FuxWebPage}

@

So nothing out of ordinary here,

Regards,

RE: WDialog not positioning correctly - Added by Koen Deforche almost 11 years ago

Hey,

I could now reproduce the issue, thanks. This is a problem only because the auth module (with standard CSS theme) loads in a new stylesheet (form.css), but loading a stylesheet cannot be done reliably asynchronously.

A workaround is to load it before showing the dialog, e.g. in the application constructor:

 useStyleSheet("resources/form.css");

Regards,

koen

RE: WDialog not positioning correctly - Added by Aleksander Fular almost 11 years ago

Thanks for looking into that!

I will definitely use the workaround.

Regards,

    (1-4/4)