Select the current language in the ComboBox, and change it's style

This commit is contained in:
Laci bá
2021-11-09 20:50:38 +01:00
parent 5616ffbed2
commit 11527d39b0
3 changed files with 16 additions and 4 deletions

View File

@@ -321,7 +321,7 @@ BEGIN
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,100,212 LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,100,212
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,373,1 CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,373,1
LTEXT "Language:",IDT_1700,7,237,41,10 LTEXT "Language:",IDT_1700,7,237,41,10
COMBOBOX IDC_COMBO_LANG,48,236,108,120,CBS_DROPDOWN | WS_VSCROLL | COMBOBOX IDC_COMBO_LANG,48,236,108,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP WS_TABSTOP
END END

View File

@@ -324,7 +324,7 @@ BEGIN
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,100,212 LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,100,212
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,373,1 CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,226,373,1
LTEXT "Nyelv:",IDT_1700,7,237,41,10 LTEXT "Nyelv:",IDT_1700,7,237,41,10
COMBOBOX IDC_COMBO_LANG,48,236,108,120,CBS_DROPDOWN | WS_VSCROLL | COMBOBOX IDC_COMBO_LANG,48,236,108,120,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP WS_TABSTOP
END END

View File

@@ -318,12 +318,19 @@ settings_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn
return(i); return(i);
} }
int enum_helper = -1, c = 0;
BOOL CALLBACK BOOL CALLBACK
EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam) EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam)
{ {
wchar_t temp[LOCALE_NAME_MAX_LENGTH + 1]; wchar_t temp[LOCALE_NAME_MAX_LENGTH + 1];
LCIDToLocaleName(wIDLanguage, temp, LOCALE_NAME_MAX_LENGTH, 0); LCIDToLocaleName(wIDLanguage, temp, LOCALE_NAME_MAX_LENGTH, 0);
SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)temp); SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)temp);
if (wIDLanguage == temp_language)
enum_helper = c;
c++;
return 1; return 1;
} }
@@ -331,8 +338,13 @@ EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLan
static void static void
win_fill_languages(HWND hdlg) win_fill_languages(HWND hdlg)
{ {
SendMessage(GetDlgItem(hdlg, IDC_COMBO_LANG), CB_GETCURSEL, 0, 0); temp_language = GetThreadUILanguage();
EnumResourceLanguages(hinstance, RT_MENU, L"MainMenu", &EnumResLangProc, (LPARAM)GetDlgItem(hdlg, IDC_COMBO_LANG)); HWND lang_combo = GetDlgItem(hdlg, IDC_COMBO_LANG);
SendMessage(lang_combo, CB_RESETCONTENT, 0, 0);
EnumResourceLanguages(hinstance, RT_MENU, L"MainMenu", &EnumResLangProc, (LPARAM)lang_combo);
SendMessage(lang_combo, CB_SETCURSEL, enum_helper, 0);
} }
/* This does the initial read of global variables into the temporary ones. */ /* This does the initial read of global variables into the temporary ones. */