/************************************************************************* Handler for mouse button down events in editbox *************************************************************************/ bool Combobox::editbox_MouseDownHandler(const EventArgs& e) { // only interested in left button if (((const MouseEventArgs&)e).button == LeftButton) { // if edit box is read-only, show list if (d_editbox->isReadOnly()) { showDropList(); // if there is an item with the same text as the edit box, pre-select it ListboxItem* item = d_droplist->findItemWithText(d_editbox->getText(), NULL); if (item != NULL) { d_droplist->setItemSelectState(item, true); d_droplist->ensureItemIsVisible(item); } // no matching item, so select nothing else { d_droplist->clearAllSelections(); } return true; } } return false; }
/************************************************************************* Handler function for button clicks. *************************************************************************/ bool Combobox::button_PressHandler(const EventArgs&) { selectListItemWithEditboxText(); showDropList(); return true; }
/************************************************************************* Handler function for button clicks. *************************************************************************/ bool Combobox::button_PressHandler(const EventArgs& e) { showDropList(); // if there is an item with the same text as the edit box, pre-select it ListboxItem* item = d_droplist->findItemWithText(d_editbox->getText(), NULL); if (item != NULL) { d_droplist->setItemSelectState(item, true); d_droplist->ensureItemIsVisible(item); } // no matching item, so select nothing else { d_droplist->clearAllSelections(); } return true; }