Listing 4
// question with buttons : Yes, No, Yes All, No All, Cancel
// and a "Show This again" check box
struct question : wnd_extend<dialog,my_dialog> {
my_dialog(const string & text, bool enable_yes_all, bool enable_no_all) {
// note: you need a conversion to a specific type only
// when you need a method that is found only in that type
// For instance, the text()/ enable() methods are present for all windows
// the icon() method is specific to labels
// the button_style() method is specific to buttons
// the check() method is specific to checkboxes
child(IDYESALL)->text( "Yes All");
child(IDNOALL)->text( "No All");
child(IDYESALL)->enable( enable_yes_all);
child(IDNOALL)->enable( enable_no_all);
child(ID_Question)->text( text);
child<label>(ID_Question)->icon( IDI_QUESTION);
// make this button default
child<button>(IDYES)->button_style(BS_DEFPUSHBUTTON);
child(IDSHOWAGAIN)->text("Show This Again");
child<check_box>(IDSHOWAGAIN)->check(true); // checked by default
}
};