UP/DOWN keys binding for checking panel

Money Manager Ex Development related posts for both Android and Desktop

Moderator: Renato

Post Reply
Nikolay
MMEX Developer
Posts: 1535
Joined: Sat Dec 06, 2008 2:27 pm
Are you a spam bot?: No
Location: Sankt-Petersburg, Russia

UP/DOWN keys binding for checking panel

Post by Nikolay »

Code: Select all

    void onChoiceTransChar (wxKeyEvent& event);
    void onChoiceStatusChar (wxKeyEvent& event);

Code: Select all

    choiceStatus_->Connect(ID_DIALOG_TRANS_STATUS, wxEVT_CHAR, wxKeyEventHandler(mmTransDialog::onChoiceStatusChar), NULL, this);
...
    choiceTrans_->Connect(ID_DIALOG_TRANS_TYPE, wxEVT_CHAR, wxKeyEventHandler(mmTransDialog::onChoiceTransChar), NULL, this);
...
void mmTransDialog::onChoiceTransChar(wxKeyEvent& event)
{   
	wxChoice* choice = (wxChoice*)FindWindow(ID_DIALOG_TRANS_TYPE);
    int i = choice->GetSelection();
    if (event.GetKeyCode()==WXK_DOWN) {
	    if (i < DEF_TRANSFER)
	        choice->SetSelection(++i);
} else if (event.GetKeyCode()==WXK_UP){
	    if (i > DEF_WITHDRAWAL)
	        choice->SetSelection(--i);
}
        updateControlsForTransType();
        event.Skip(); 
}
void mmTransDialog::onChoiceStatusChar(wxKeyEvent& event)
{   
	wxChoice* choice = (wxChoice*)FindWindow(ID_DIALOG_TRANS_STATUS);
    int i = choice->GetSelection();
    if (event.GetKeyCode()==WXK_DOWN) {
	    if (i < DEF_STATUS_DUPLICATE)
	        choice->SetSelection(++i);
    } else if (event.GetKeyCode()==WXK_UP){
	    if (i > DEF_STATUS_NONE)
	        choice->SetSelection(--i);
    }
        event.Skip(); 
}
Post Reply