/** Processing commands for charset combobox (hwndCtl). */ void processCharsetCombobox(HWND hwnd, HWND hwndCtl, UINT codeNotify) { switch(codeNotify) { /* Loading list and adjust its height if button clicked and on user input */ case(CBN_DROPDOWN): { //FillParameters(hwnd, *pParams); LIST *csl= mygetcharsets(hwnd, pParams); LIST *cstmp= csl; ComboBox_ResetContent(hwndCtl); adjustDropdownHeight(hwndCtl,list_length(csl)); for (; cstmp; cstmp= list_rest(cstmp)) ComboBox_AddString(hwndCtl, (SQLWCHAR *)cstmp->data); list_free(csl, 1); ComboBox_SetText(hwndCtl,pParams->charset); break; } } }
INT_PTR CWildcardSelectDialog::OnInitDialog() { m_hDialogIcon = LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(IDI_MAIN_SMALL)); SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon)); HWND hComboBox = GetDlgItem(m_hDlg,IDC_SELECTGROUP_COMBOBOX); for each(auto strPattern in m_pwsdps->m_PatternList) { ComboBox_InsertString(hComboBox,-1,strPattern.c_str()); } ComboBox_SetText(hComboBox,m_pwsdps->m_szPattern); if(!m_bSelect) { TCHAR szTemp[64]; LoadString(GetInstance(),IDS_WILDCARDDESELECTION, szTemp,SIZEOF_ARRAY(szTemp)); SetWindowText(m_hDlg,szTemp); } SetFocus(hComboBox); m_pwsdps->RestoreDialogPosition(m_hDlg,true); return 0; }
void SppTabFltr::InitFilter(int nFilters, LPTSTR FilterName) { // Clear Filter display HWND hCombo = GetDlgItem(m_hDlg, IDC_COMBO_FILTERS); SendMessage(hCombo,(UINT) CB_RESETCONTENT ,(WPARAM) 0,(LPARAM)0); HWND hFilterCB = GetDlgItem(m_hDlg, IDC_CH_FILTER); // If there are filters then prepare data for selection if (nFilters) { // Bring "-- Select Filter --" to top ComboBox_SetText(hCombo, TEXT("-- Select Filter --")); // Display File name HWND hFilterFile = GetDlgItem(m_hDlg, IDC_EDIT_FILTERFILE); _tcscpy_s(&(m_FilterFileName[0]), sizeof(m_FilterFileName)/sizeof(TCHAR),FilterName); Edit_SetText(hFilterFile, FilterName); UpdateWindow(hFilterFile); } else { ComboBox_Enable(hCombo, FALSE); Button_SetCheck(hFilterCB, BST_UNCHECKED); ShowChannelArea( m_hDlg, false); m_FilterActive = false; SentFilterInfo2Parent(); }; EnableWindow(hFilterCB, false); }
/** Processing commands for dbname combobox (hwndCtl). */ void processDbCombobox(HWND hwnd, HWND hwndCtl, UINT codeNotify) { switch(codeNotify) { /* Loading list and adjust its height if button clicked and on user input */ case(CBN_DROPDOWN): { FillParameters(hwnd, pParams); LIST *dbs= mygetdatabases(hwnd, pParams); LIST *dbtmp= dbs; ComboBox_ResetContent(hwndCtl); adjustDropdownHeight(hwndCtl,list_length(dbs)); for (; dbtmp; dbtmp= list_rest(dbtmp)) ComboBox_AddString(hwndCtl, (SQLWCHAR *)dbtmp->data); list_free(dbs, 1); ComboBox_SetText(hwndCtl,pParams->database); break; } } }
void CZoomCombo::Assimilate (CForum * pForum) { if (pForum == &ZoomForum) { STRING szPercentage; wsprintf(szPercentage, "%d%%", ZoomForum.GetViewPercentage()); ComboBox_SetText(m_hWnd, szPercentage); } }
void setComboFieldDataTab(SQLWCHAR *param, unsigned int framenum, int idc) { if ( TabCtrl_1.hTabPages[framenum-1]) { HWND tabHwndMisc = TabCtrl_1.hTabPages[framenum-1]; HWND charsetCtrl = GetDlgItem(tabHwndMisc, idc); ComboBox_SetText(charsetCtrl, param); } }
/* * TextInputSetText: Set the contents of the text input box to the given string. * If focus is True, set focus to text input box. */ void TextInputSetText(char *text, Bool focus) { int len; ComboBox_SetText(hwndInput, text); len = ComboBox_GetTextLength(hwndInput); if (focus) SetFocus(hwndInput); ComboBox_SetEditSel(hwndInput, len, len); // Move caret to end of text }
/*------------------------------------------------ --------------------------------------------------*/ void SetComboFontSize(HWND hDlg, BOOL bInit) { HDC hdc; wchar_t font[LF_FACESIZE]; DWORD size; LOGFONT lf = {0}; HWND size_cb = GetDlgItem(hDlg, IDC_FONTSIZE); HWND font_cb = GetDlgItem(hDlg, IDC_FONT); int pos; // remember old size if(bInit) { // on WM_INITDIALOG size = api.GetInt(L"Clock", L"FontSize", 9); if(!size || size>100) size = 9; } else { // when IDC_FONT has been changed ComboBox_GetText(size_cb, font, _countof(font)); size = _wtoi(font); } ComboBox_ResetContent(size_cb); hdc = GetDC(NULL); m_logpixelsy = GetDeviceCaps(hdc, LOGPIXELSY); ComboBox_GetLBText(font_cb, ComboBox_GetCurSel(font_cb), font); wcscpy(lf.lfFaceName, font); lf.lfCharSet = DEFAULT_CHARSET; EnumFontFamiliesEx(hdc, &lf, EnumSizeProcEx, (LPARAM)size_cb, 0); ReleaseDC(NULL, hdc); wsprintf(font, FMT("%d"), size); pos = ComboBox_FindStringExact(size_cb, -1, font); if(pos != LB_ERR) { ComboBox_SetCurSel(size_cb, pos); return; } ComboBox_SetText(size_cb, font); }
KeyConfigControl::KeyConfigControl( vlc_object_t *p_this, module_config_t *p_item, HWND parent, HINSTANCE hInst, int * py_pos ) : ConfigControl( p_this, p_item, parent, hInst ) { // Init the keys decriptions array if( m_keysList == NULL ) { m_keysList = new string[vlc_num_keys]; for( size_t i = 0; i < vlc_num_keys; ++i ) { m_keysList[i] = vlc_keys[i].psz_key_string; } } label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text), WS_CHILD | WS_VISIBLE | SS_LEFT, 5, *py_pos, 200, 15, parent, NULL, hInst, NULL ); *py_pos += 15 + 10; alt = CreateWindow( _T("BUTTON"), _T("Alt"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 20, *py_pos, 15, 15, parent, NULL, hInst, NULL ); Button_SetCheck( alt, p_item->i_type & KEY_MODIFIER_ALT ? BST_CHECKED : BST_UNCHECKED ); alt_label = CreateWindow( _T("STATIC"), _T("Alt"), WS_CHILD | WS_VISIBLE | SS_LEFT, 20 + 15 + 5, *py_pos, 30, 15, parent, NULL, hInst, NULL ); ctrl = CreateWindow( _T("BUTTON"), _T("Ctrl"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 20 + 15 + 5 + 30 + 5, *py_pos, 15, 15, parent, NULL, hInst, NULL ); Button_SetCheck( ctrl, p_item->i_type & KEY_MODIFIER_CTRL ? BST_CHECKED : BST_UNCHECKED ); ctrl_label = CreateWindow( _T("STATIC"), _T("Ctrl"), WS_CHILD | WS_VISIBLE | SS_LEFT, 20 + 15 + 5 + 30 + 5 + 15 + 5, *py_pos, 30, 15, parent, NULL, hInst, NULL ); shift = CreateWindow( _T("BUTTON"), _T("Shift"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 20 + 15 + 5 + 2*(30 + 5) + 15 + 5, *py_pos, 15, 15, parent, NULL, hInst, NULL ); Button_SetCheck( shift, p_item->i_type & KEY_MODIFIER_SHIFT ? BST_CHECKED : BST_UNCHECKED ); shift_label = CreateWindow( _T("STATIC"), _T("Shift"), WS_CHILD | WS_VISIBLE | SS_LEFT, 20 + 15 + 5 + 2*(30 + 5) + 2*(15 + 5), *py_pos, 30, 15, parent, NULL, hInst, NULL ); *py_pos += 15 + 10; combo = CreateWindow( _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL, 20, *py_pos, 130, 5*15 + 6, parent, NULL, hInst, NULL ); *py_pos += 15 + 10; for( size_t i = 0; i < vlc_num_keys ; ++i ) { ComboBox_AddString( combo, _FROMMB(m_keysList[i].c_str()) ); ComboBox_SetItemData( combo, i, (void*)vlc_keys[i].i_key_code ); if( (unsigned int)vlc_keys[i].i_key_code == ( ((unsigned int)p_item->i_type) & ~KEY_MODIFIER ) ) { ComboBox_SetCurSel( combo, i ); ComboBox_SetText( combo, _FROMMB(m_keysList[i].c_str()) ); } } }
/*------------------------------------------------ Dialog procedure --------------------------------------------------*/ INT_PTR CALLBACK Page_Color(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: OnInit(hDlg); return TRUE; case WM_DESTROY:{ HFONT hfontb=(HFONT)SendDlgItemMessage(hDlg,IDC_BOLD,WM_GETFONT,0,0); HFONT hfonti=(HFONT)SendDlgItemMessage(hDlg,IDC_ITALIC,WM_GETFONT,0,0); SendDlgItemMessage(hDlg,IDC_BOLD,WM_SETFONT,0,0); SendDlgItemMessage(hDlg,IDC_ITALIC,WM_SETFONT,0,0); DeleteObject(hfontb); DeleteObject(hfonti); break;} case WM_MEASUREITEM: return ColorBox_OnMeasureItem(wParam, lParam); case WM_DRAWITEM: return ColorBox_OnDrawItem(wParam, lParam); case WM_COMMAND: { WORD id=LOWORD(wParam); switch(HIWORD(wParam)){ case CBN_SELCHANGE: if(id==IDC_COLFORE || id==IDC_COLBACK || id==IDC_FONT || id==IDC_FONTQUAL || id==IDC_FONTSIZE){ if(id==IDC_FONT) SetComboFontSize(hDlg, FALSE); SendPSChanged(hDlg); } break; case CBN_EDITCHANGE: if(id==IDC_FONTSIZE) SendPSChanged(hDlg); break; case EN_CHANGE: if(id==IDC_CLOCKHEIGHT || id==IDC_CLOCKWIDTH || id==IDC_ALPHATB || id==IDC_VERTPOS || id==IDC_LINEHEIGHT || id==IDC_HORIZPOS || id==IDC_ANGLE){ SendPSChanged(hDlg); } break; default: if(id==IDC_COLFORE_BTN || id==IDC_COLBACK_BTN){ ColorBox_ChooseColor((HWND)lParam); }else if(id==IDC_CHOOSEFONT){ HWND hwndCombo; HDC hdc; wchar_t size[8]; LOGFONT lf = {0}; CHOOSEFONT chosenfont = {sizeof(CHOOSEFONT)}; chosenfont.hwndOwner = hDlg; chosenfont.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_PRINTERFONTS | CF_SCREENFONTS; chosenfont.lpLogFont = &lf; hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE); ComboBox_GetText(hwndCombo, size, _countof(size)); hdc = GetDC(NULL); lf.lfWeight = IsDlgButtonChecked(hDlg, IDC_BOLD) ? FW_BOLD : FW_REGULAR; lf.lfItalic = (BYTE)IsDlgButtonChecked(hDlg, IDC_ITALIC); lf.lfHeight = -MulDiv(_wtoi(size), GetDeviceCaps(hdc,LOGPIXELSY), 72); ReleaseDC(NULL, hdc); hwndCombo = GetDlgItem(hDlg,IDC_FONT); ComboBox_GetText(hwndCombo, lf.lfFaceName, _countof(lf.lfFaceName)); if(ChooseFont(&chosenfont)){ int sel; CheckDlgButton(hDlg, IDC_BOLD, (chosenfont.lpLogFont->lfWeight >= FW_SEMIBOLD)); CheckDlgButton(hDlg, IDC_ITALIC, chosenfont.lpLogFont->lfItalic); ComboBox_SelectString(hwndCombo, -1, chosenfont.lpLogFont->lfFaceName); hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE); wsprintf(size, FMT("%d"), chosenfont.iPointSize/10); sel = ComboBox_FindStringExact(hwndCombo, -1, size); if(sel != CB_ERR) ComboBox_SetCurSel(hwndCombo, sel); else ComboBox_SetText(hwndCombo, size); SendPSChanged(hDlg); } }else if(id==IDC_BOLD || id==IDC_ITALIC) SendPSChanged(hDlg); } return TRUE;} case WM_NOTIFY:{ PSHNOTIFY* notify=(PSHNOTIFY*)lParam; switch(notify->hdr.code) { case PSN_APPLY: OnApply(hDlg,0); if(notify->lParam) m_transition=-1; break; case PSN_RESET: if(m_transition==1){ SendMessage(g_hwndClock, CLOCKM_REFRESHCLOCK, 0, 0); SendMessage(g_hwndClock, CLOCKM_REFRESHTASKBAR, 0, 0); api.DelKey(L"Preview"); } m_transition=-1; break; } return TRUE;} } return FALSE; }