//----------------------------------------------------------------------------- int32_t CFrame::onKeyDown (VstKeyCode& keyCode) { int32_t result = -1; result = keyboardHooksOnKeyDown (keyCode); if (result == -1 && pFocusView) { CBaseObjectGuard og (pFocusView); if (pFocusView->getMouseEnabled ()) result = pFocusView->onKeyDown (keyCode); if (result == -1) { CView* parent = pFocusView->getParentView (); while (parent != this && result == -1) { if (parent->getMouseEnabled ()) result = parent->onKeyDown (keyCode); parent = parent->getParentView (); } } } if (result == -1 && pModalView) { CBaseObjectGuard og (pModalView); result = pModalView->onKeyDown (keyCode); } if (result == -1 && keyCode.virt == VKEY_TAB) result = advanceNextFocusView (pFocusView, (keyCode.modifier & MODIFIER_SHIFT) ? true : false) ? 1 : -1; return result; }
//---------------------------------------------------------------------------------------------------- int32_t UIDialogController::onKeyDown (const VstKeyCode& code, CFrame* frame) { CBaseObjectGuard guard (this); int32_t result = -1; CView* focusView = frame->getFocusView (); if (focusView) result = focusView->onKeyDown (const_cast<VstKeyCode&> (code)); if (result == -1) { if (code.virt == VKEY_RETURN && code.modifier == 0) { button1->setValue (button1->getMax ()); button1->valueChanged (); return 1; } if (code.virt == VKEY_ESCAPE && code.modifier == 0 && button2->isVisible ()) { button2->setValue (button2->getMax ()); button2->valueChanged (); return 1; } } return result; }