ccombobox

CComboBox not selecting CurSel when dropped down

て烟熏妆下的殇ゞ 提交于 2020-07-20 17:26:21
问题 I have an alphabetically sorted combobox in a dialog. This combo contains multiple strings, but some are duplicated with different cases. i.e. we have an 'On' and an 'ON', an 'Off' and an 'OFF'. This may seem redundant but there is a reason, although this is not important right now. The duplicates obviously appear one after the other in the list, with the capitalized strings first. i.e.: OFF Off ON On When the user selects the 'On' (lower case), the correct index is set as CurSel and the

CComboBox not selecting CurSel when dropped down

空扰寡人 提交于 2020-07-20 17:26:19
问题 I have an alphabetically sorted combobox in a dialog. This combo contains multiple strings, but some are duplicated with different cases. i.e. we have an 'On' and an 'ON', an 'Off' and an 'OFF'. This may seem redundant but there is a reason, although this is not important right now. The duplicates obviously appear one after the other in the list, with the capitalized strings first. i.e.: OFF Off ON On When the user selects the 'On' (lower case), the correct index is set as CurSel and the

How to change CComboBox edit control's height?

独自空忆成欢 提交于 2020-05-13 14:42:26
问题 CComboBox contains one text edit window and a dropdown window. I intend to change the text edit control's height. Any suggestion is appreciated. 回答1: Set font of Combobox control. // *.h CComboBox m_combo1; // *.cpp CFont comboFont; comboFont.Create(18, 0, 0, 0, FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_NATURAL_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Arial")); m_combo1.SetFont(&comboFont); ... 回答2: From MSDN: Call the SetItemHeight member

VC++ COMBO BOX控件的使用

痴心易碎 提交于 2020-03-08 11:11:07
1.你在编辑状态下点那个控件的向下的三角形,就出冒出来一个可以调高度的东东。将高度调高,否则在执行时会不能显示下拉选项。 2.为combo box添加选项,在编辑状态下选combo box控件的属性,选Data标签,在编辑框中添加选项,按Ctrl-Enter来添加下一个选项。 3.为combo box添加变量 combo box有两个变量,CComboBox类变量和CString变量。 CComboBox变量用来设置combo box的属性,一般在cdialog类中的oninitdialog()函数中使用。添加方法是在classwizard中添加变量,添加时Category中选Control。例如:CComboBox.SetCurSel(0)用来设置下拉菜单初始值,具体看MSDN。 CString变量用来存储下拉菜单所选的选项值。同样,当选项发生变化时要使用UpdateData(TRUE)函数更新该变量的值。 ----------------------------------------------------------------------------------------------------------------- 一、初始化Combo Box控件 (1)在资源视图中,选择控件的"Properties",然后在Data选项卡里为控件添加初始化数据,换行是按Ctrl

MFC CComboBoxEx icon update issue

一曲冷凌霜 提交于 2019-12-20 06:19:46
问题 I am using the CComboBoxEx control in MFC to implement an address box for a browser application which shows the address and the related site icon. According this link: http://msdn.microsoft.com/en-us/library/bb775788(v=vs.85).aspx, calling CComboBoxEx::SetItem with iItem of -1 will modify the item currently displayed in the edit control. Here is the code segment I use to HICON hIcon=LoadIcon(....); //load the new icon from somewhere imagelist.Replace(1,hIcon); //replace the existing icon in

Working out the maximum drop-down width for a CComboBoxEx with icons

ぐ巨炮叔叔 提交于 2019-12-11 07:21:47
问题 I have seen this article on CodeProject for setting the width of a CComboBox dynamically. However, I am using a CComboBoxEx : As you can see with the last entry it is cropped. So I would like to automatically widen the drop-down list. It needs to take into account the fact that their is a space for an icon on the left too. So this won't be good enough: BOOL CMyComboBox::OnCbnDropdown() { // Reset the dropped width CString str; CRect rect; int nWidth = 0; int nNumEntries = GetCount();;

Detect keyboard hotkey inside edit control of CComboBox

半城伤御伤魂 提交于 2019-12-11 04:06:39
问题 I have this code: BOOL CChristianLifeMinistryStudentMaterialDlg::PreTranslateMessage(MSG* pMsg) { BOOL bNoDispatch, bDealtWith; bDealtWith = FALSE; if (IsCTRLpressed() && pMsg->message == WM_KEYDOWN && pMsg->wParam == _TINT(_T('I'))) { if (EncodeText(pMsg->hwnd, _T("i"))) { // Eat it. bNoDispatch = TRUE; bDealtWith = TRUE; } } else if (IsCTRLpressed() && pMsg->message == WM_KEYDOWN && pMsg->wParam == _TINT(_T('B'))) { if (EncodeText(pMsg->hwnd, _T("b"))) { // Eat it. bNoDispatch = TRUE;

MFC CComboBoxEx icon update issue

戏子无情 提交于 2019-12-02 09:31:27
I am using the CComboBoxEx control in MFC to implement an address box for a browser application which shows the address and the related site icon. According this link: http://msdn.microsoft.com/en-us/library/bb775788(v=vs.85).aspx , calling CComboBoxEx::SetItem with iItem of -1 will modify the item currently displayed in the edit control. Here is the code segment I use to HICON hIcon=LoadIcon(....); //load the new icon from somewhere imagelist.Replace(1,hIcon); //replace the existing icon in the image list. int nImage=1; item.mask = CBEIF_IMAGE|CBEIF_SELECTEDIMAGE ; item.iItem = -1; item

Catching when user selects an item from a CComboBox

你说的曾经没有我的故事 提交于 2019-12-01 17:38:55
This is as basic as it gets. I want to catch when the user selects an item from a CComboBox (actually, a subclass of CComboBox ). Tried lots of combinations of OnCblSelChange , OnCommand . Guess I haven't hit the right combo yet (no pun intended). OS is Vista but I'm forcing an XP-style dialog (That shouldn't matter, should it?) I'm able to catch events for classes derived from CEdit and CFileDialog . I am at my wits end here. Any assistance would be ever-so appreciated. Any source code would, of course, be more than ever-so appreciated. Smashery Unfortunately, it seems that all messages (even

Catching when user selects an item from a CComboBox

好久不见. 提交于 2019-12-01 15:55:58
问题 This is as basic as it gets. I want to catch when the user selects an item from a CComboBox (actually, a subclass of CComboBox ). Tried lots of combinations of OnCblSelChange , OnCommand . Guess I haven't hit the right combo yet (no pun intended). OS is Vista but I'm forcing an XP-style dialog (That shouldn't matter, should it?) I'm able to catch events for classes derived from CEdit and CFileDialog . I am at my wits end here. Any assistance would be ever-so appreciated. Any source code would