Project

General

Profile

WDialog add extra argument to signal

Added by David Kauderer almost 7 years ago

Hello Folks,

I want to use a WDialog. I played a bit around with it and so far everything is clear and works.

To make use of the dialog I want to add an extra argument to the slot that is called when the WDialog is closed.

Similar to how it's done with buttons. Something like:

dialog_->finished().connect(boost::bind(&MyClass::dialogDone, this, myExtraArg));

and then

void MyClass::dialogDone(Wt::WDialog::DialogCode code, myExtraArgType myExtraArg) {
//somethingsomething
}

Is this possible?


Replies (1)

RE: WDialog add extra argument to signal - Added by Wim Dumon almost 7 years ago

This looks ok. Do you have a problem when you do this?

There's probably a small mistake in your code, since you'll have to leave a parameter unbound:

dialog_->finished().connect(boost::bind(&MyClass::dialogDone, this, _1, myExtraArg));

The _1 etc placeholders are standard boost::bind (and std::bind) functionality, not specific to Wt.

Best regards,

Wim.

    (1-1/1)