Bug #1364
closedUnable to retrieve the 'Ok' StandardButton from a WMessageBox
0%
Description
When I create a WMessageBox with an 'Ok' StandardButton, I get a null pointer when calling 'button(Ok)'.
Example code:
WMessageBox * msgBox = new Wt::WMessageBox(
"Just a messagebox",
"Hi there",
Warning,
Yes | Ok
);
WPushButton* pYesButton = msgBox->button(Yes); // this works
WPushButton* pOkButton = msgBox->button(Ok); // this doesn't work
Problem seems located in WMessageBox.c
The array 'order_' has 'Ok' at index 0:
From WMessabeBox.c: ¶
StandardButton WMessageBox::order_[] = { Ok, Yes, YesAll, Retry, No,
NoAll, Abort, Ignore, Cancel }; ¶
The 'button' function starts using this array from index 1.
Found this with Wt 3.2.1.
Updated by S van der Hoest over 12 years ago
Found that it also goes wrong after adding a button using the 'addButton' function.
The 'button' function checks 'buttons_' which is not updated by the 'addButton' function.
Updated by Wim Dumon over 12 years ago
- Status changed from New to Resolved
Confirmed and fixed - that 1 should be a 0.
Note that without fixing the bug, the button() method may also return the wrong button.
BR,
Wim.
Updated by Koen Deforche about 12 years ago
- Status changed from Resolved to Closed
- Target version set to 3.2.3
Fixed in Wt 3.2.3 RC1.