@@ -78,7 +78,7 @@ class MyFrame : public wxFrame
7878 // horizontal sizer holding the slider and label
7979 wxBoxSizer* sliderSizer = new wxBoxSizer (wxHORIZONTAL);
8080
81- passwordLenText = new wxTextCtrl (panel, wxID_ANY, wxEmptyString , wxDefaultPosition, wxSize (100 , 25 ));
81+ passwordLenText = new wxTextCtrl (panel, wxID_ANY, " 10 " , wxDefaultPosition, wxSize (100 , 25 ));
8282 passwordLenText->SetForegroundColour (lightText);
8383 passwordLenText->SetBackgroundColour (darkControlBg);
8484 sliderSizer->Add (passwordLenText, 0 , wxALL, 5 );
@@ -97,6 +97,7 @@ class MyFrame : public wxFrame
9797
9898 // Create the text field.
9999 wxTextCtrl* excludedCharsTextCtrl = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (100 , 25 ));
100+ excludedCharsTextCtrl->SetFocus ();
100101 excludedCharsTextCtrl->SetBackgroundColour (darkControlBg);
101102 excludedCharsTextCtrl->SetForegroundColour (lightText);
102103
@@ -141,9 +142,8 @@ class MyFrame : public wxFrame
141142 generateBtn->SetForegroundColour (lightText);
142143 generateSizer->Add (generateBtn, 0 , wxALL, 5 );
143144
144- // Read-only text field for the generated password. passwordText is a member
145- passwordText = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (250 , 25 ),
146- wxTE_READONLY);
145+ // text field for the generated password. passwordText is a member
146+ passwordText = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (250 , 25 ));
147147 passwordText->SetBackgroundColour (darkControlBg);
148148 passwordText->SetForegroundColour (lightText);
149149 generateSizer->Add (passwordText, 0 , wxALL, 5 );
@@ -303,6 +303,13 @@ class MyFrame : public wxFrame
303303
304304 saveBtn->Bind (wxEVT_BUTTON, [&](wxCommandEvent& event)
305305 {
306+ if (hashText->GetValue ().empty ())
307+ {
308+ std::cerr << " Hash text is empty!" << std::endl;
309+ wxLogError (" Hash text is empty!" );
310+ return ;
311+ }
312+
306313 try
307314 {
308315 SQLite::Statement insertQuery (db, " INSERT INTO passwords (hash) VALUES (?)" );
0 commit comments