static void OnSelChange_Combo(HWND hWnd) { // Store the previously used LibraryID int prevLibID = s_curLibrary->GetLibraryID(); // Get current LibraryID from the selected item int item = (int) SendDlgItemMessage(hWnd, IDC_NAME, CB_GETCURSEL, 0, 0L); s_curLibrary = (Library*) SendDlgItemMessage(hWnd, IDC_NAME, CB_GETITEMDATA, (WPARAM) item, 0); // Did the library ID really change? if (prevLibID == s_curLibrary->GetLibraryID()) return; // Open the database g_db->Open(); // Update the database char szSQL[MAX_PATH]; _snprintf(szSQL, MAX_PATH, "DELETE FROM LangLastUsed WHERE Lang = %d; INSERT INTO LangLastUsed(Lang,LibraryID) VALUES(%d,%d);", s_curLang, s_curLang, s_curLibrary->GetLibraryID()); g_db->Execute(szSQL); // Update the list with snippets ClearListItems(); AddListItems(); g_db->Close(); }
void UpdateSnippetsList() { if (!s_bConsoleVisible) return; WaitCursor wait; ClearComboItems(); ClearListItems(); g_db->Open(); AddComboItems(); AddListItems(); g_db->Close(); }
void DialogReplacePiece::OnBtnAddPieceClicked(wxCommandEvent& event) { wxFileDialog dialog(this, _("Choose a file"), ProjectDocument::GetInstance().GetRootPath(), wxEmptyString, _("Image files (*.png;*.jpg)|*.png;*.jpg"), wxFD_OPEN|wxFD_MULTIPLE); if (dialog .ShowModal() == wxID_OK) { wxArrayString arrayString; dialog.GetPaths(arrayString); AddListItems(arrayString); } event.Skip(); }