add button & fix buttonpanel crash bug

This commit is contained in:
2025-08-28 21:18:16 -05:00
parent 48f5b8fc1c
commit 843c119e5c
3 changed files with 4 additions and 2 deletions

View File

@@ -9,7 +9,8 @@
<button type='tiny' name='button3' relative='pos-in pos-in' rel-anchor='prev' top='15' left='0'/>
<button type='tiny' name='button4' relative='pos-in pos-in' rel-anchor='prev' top='15' left='0'/>
<button type='tiny' name='button5' relative='pos-in pos-in' rel-anchor='prev' top='15' left='0'/>
<button name='left' type='left' def-key='left' relative='pos-in pos-in' anchor='button5' top='19' left='0'/>
<button type='tiny' name='button6' relative='pos-in pos-in' rel-anchor='prev' top='15' left='0'/>
<button name='left' type='left' def-key='left' relative='pos-in pos-in' anchor='button6' top='19' left='0'/>
<button name='right' type='right' def-key='right' relative='pos-in pos-in' rel-anchor='prev' top='0' left='63'/>
<button name='cancel' type='regular' relative='pos-in pos-in' rel-anchor='prev' top='0' left='101'>Cancel</button>
<button name='done' type='regular' relative='pos-in pos-in' rel-anchor='prev' top='0' left='66'>OK</button>

View File

@@ -57,6 +57,7 @@ cDialog* cButtonPanel::operator->() {
bool cButtonPanel::show() {
page = 0;
dlg.setResult(false); // If the dialog toasts itself, don't crash or trigger any 'confirm' action
dlg.run(std::bind(&cButtonPanel::fillPage, this));
return dlg.getResult<bool>();
}

View File

@@ -11,7 +11,7 @@
/// A dialog that presents a list of labeled tiny buttons, plus an OK and Cancel button.
/// The list may span several pages.
class cButtonPanel {
const size_t per_page = 5;
const size_t per_page = 6;
cDialog dlg;
bool onLeft();
bool onRight();