Add EnterPressed handled in UserDialog and Search (for description)

This commit is contained in:
2011-04-09 19:22:32 +02:00
parent 0e93b41bc7
commit 7533319ad4
4 changed files with 22 additions and 8 deletions

View File

@@ -19,12 +19,13 @@
#include "UsersDialog.h"
enum {BUTTON_OK_ID=1, BUTTON_CANCEL_ID, BUTTON_NEW_USER_ID};
enum {TEXT_PASSWORD_ID=1, BUTTON_OK_ID, BUTTON_CANCEL_ID, BUTTON_NEW_USER_ID};
BEGIN_EVENT_TABLE(UsersDialog, wxDialog)
EVT_BUTTON(BUTTON_OK_ID, UsersDialog::OnOK)
EVT_BUTTON(BUTTON_CANCEL_ID, UsersDialog::OnCancel)
EVT_BUTTON(BUTTON_NEW_USER_ID, UsersDialog::OnNewUser)
EVT_TEXT_ENTER(TEXT_PASSWORD_ID, UsersDialog::OnEnter)
END_EVENT_TABLE()
UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), -1, _("Users")), _kiss(kiss), _wxUI(parent)
@@ -36,18 +37,17 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), -
wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
gridBagSizer = new wxGridBagSizer(4, 4);
label = new wxStaticText(this, -1, _("User "));
label = new wxStaticText(this, wxID_ANY, _("User "));
gridBagSizer->Add(label, wxGBPosition(0, 0));
_users = new wxChoice(this, wxID_ANY);
gridBagSizer->Add(_users, wxGBPosition(0, 1));
label = new wxStaticText(this, -1, _("Password "));
label = new wxStaticText(this, wxID_ANY, _("Password "));
gridBagSizer->Add(label, wxGBPosition(1, 0));
_password = new wxTextCtrl(this, wxID_ANY);
_password = new wxTextCtrl(this, TEXT_PASSWORD_ID);
_password->SetWindowStyle(_password->GetWindowStyle() | wxTE_PASSWORD | wxTE_PROCESS_ENTER);
gridBagSizer->Add(_password, wxGBPosition(1, 1));
_password->SetWindowStyle(wxTE_PASSWORD);
wxButton* ok = new wxButton(this, BUTTON_OK_ID, _("OK"));
wxButton* cancel = new wxButton(this, BUTTON_CANCEL_ID, _("Cancel"));
wxButton* newUser = new wxButton(this, BUTTON_NEW_USER_ID, _("New User"));
@@ -77,6 +77,11 @@ UsersDialog::UsersDialog(KissCount* kiss, wxUI *parent) : wxDialog(&(*parent), -
ShowModal();
}
void UsersDialog::OnEnter(wxCommandEvent& event)
{
OnOK(event);
}
void UsersDialog::OnOK(wxCommandEvent& event)
{
// No users in database