Browse Source

Fix Dexed ComboBoxImage popup only showing once, closes #8

tags/2018-04-16
falkTX 9 years ago
parent
commit
9281939642
2 changed files with 18 additions and 10 deletions
  1. +18
    -9
      ports/dexed/source/DXComponents.cpp
  2. +0
    -1
      ports/dexed/source/DXComponents.h

+ 18
- 9
ports/dexed/source/DXComponents.cpp View File

@@ -360,21 +360,30 @@ void ComboBoxImage::paint(Graphics &g) {
}
ComboBoxImage::ComboBoxImage() {
onPopup = false;
itemPos[0] = -1;
}
void ComboBoxImage::showPopup() {
if ( !onPopup ) {
onPopup = true;
int idx = popup.show() - 1;
onPopup = false;
if ( idx < 0 )
return;
setSelectedItemIndex(idx);
static void comboBoxPopupMenuFinishedCallback (int result, ComboBoxImage* combo)
{
if (combo != nullptr)
{
combo->hidePopup();
if (result != 0)
combo->setSelectedId (result);
}
}
void ComboBoxImage::showPopup() {
popup.showMenuAsync (PopupMenu::Options().withTargetComponent (this)
.withItemThatMustBeVisible (getSelectedId())
.withMinimumWidth (getWidth())
.withMaximumNumColumns (1)
.withStandardItemHeight (itemHeight),
ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this));
}
void ComboBoxImage::setImage(Image image) {
items = image;


+ 0
- 1
ports/dexed/source/DXComponents.h View File

@@ -58,7 +58,6 @@ class ComboBoxImage : public ComboBox {
Image items;
int itemHeight;
PopupMenu popup;
bool onPopup;
int itemPos[4];
public:


Loading…
Cancel
Save