ComboBox and ComboBoxEx controls use the height specified when the control is created to determine the size of the dropdown list. Version 7.4 failed to set the height of ComboBoxEx control correctly, preventing the dropdown list from being displayed.
This problem has been fixed in SVN revision 1793.
Best regards,
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have downloaded version 7.5.1 and recompiled the themes sample using MinGW/DevC++ 32-bit debug mode, whereupon I find that the combo box works as advertised now. I then ported the MyCombo.h and .cpp files from that example into a program I am composing that has 24 x 24 bit toolbar buttons. I then compiled that program the same way as the themes sample. I now find that the combo box in my program is displaced left, halfway covering the IDM_FILE_OPEN button, and that the box down arrow does not cause the drop down display of the 3 items. Are there adjustments I need to make for 24 x 24 buttons?
Thanks,
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just now put the 16-bit button original toolbar back in my program and recompiled. I find the combo box is located correctly, but still does not drop down anything. I'll try to figure out what I'm doing differently in my program than in themes (which works correctly). Hmm.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I copied all the toolbars and code pertaining to the toolbars and combo boxes from themes, along with their IDs into my win32++ template application. So, since the dropdown in themes works, it should work in my app as well. But it doesn't. See attachment for comparative results. I'm still very baffled.
ComboBoxeEx controls are somewhat unusual in that we need to specify their full drop-down size when the window is created. This is a feature of the ComboBoxEx control itself.
When creating the control, we can specify its size in PreCreate. In the theme sample, it is done like this.
void CMyCombo::PreCreate(CREATESTRUCT &cs)
{
cs.lpszClass = WC_COMBOBOXEX;
cs.style = WS_VISIBLE | WS_CHILD | CBS_DROPDOWN | WS_CLIPCHILDREN;
// Set the height of the combobox in order to see a dropdown list
cs.cy = 100;
}
There are no "special" adjustments required for 24 x 24 buttons I'm aware of. Perhaps this is also related to the combobox's initial size setting.
Best regards,
David
Last edit: David 2014-09-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I noticed that targetver.h for themes was set for Windows 98, so I changed it to XP, just to see if that made some difference. It did not. But as an experiment I changed targetver.h in my Win32++ Template app to 98, just to confirm it didn't make a difference. I recompiled everything, and lo and behold, the combo box in my app began to work. I changed it back to XP to see if it again would not work. But it still worked. I swear, these were the only changes I made, and the combo box now works as advertised! I have no idea why. I always do complete compilations when changes like this, or ones involving the .rc file, are made and it did not work until this. Miracles do happen in software, sometimes, I guess.
I was also able to replace the sample toolbar with my own with 20 24 x 24 buttons, and moved the combo box to a slot near the far right reserved for it. That worked fine, too. Then, I hid the box to its immediate left and recompiled. This time the screen showed a blank where the hidden button was, but now the combo box no longer worked.
I thought you might be interested in my progress. I am still discovering the wonder of Win32++. Thanks for your help, very much appreciated.
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems your compiler didn't recompile some of the code you changed. If in doubt, preforming a clean before the build will force a complete rebuild.
If you have access to it, Microsoft's Spy++ is a very handy utility for troubleshooting windows problems. It provides all sorts of information on each of the windows in the application. Spy++ ships with the full (but not express) versions of the Microsoft compilers. Trial versions of the full versions have Spy++ too.
Best of luck
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I guessed as much about the clean and recompiling a couple of times fixing that problem. Any theories why the combobox still fails to drop when preceded on the left by a hidden control button?
Thanks,
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should hide the toolbar button before adding the combo. If we hide the button after adding the combo, the position of the combo needs to be recalculated.
I know I mentioned this before, but the full height of the combobox, including its dropdown height, should be be specified in CMyCombo::PreCreate. The dropdown list won't be displayed unless this is done.
In the Theme sample, the combobox dropdown works properly when FileOpen button is hidden.
Best regards,
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The neat thing about toolbar buttons is that you can hide those that don't apply at some stage of your application, and the toolbar closes up to show contiguously only those that you need. This presently screws up the combo box, so I should probably put it into a separate rebar. I think I'll try that.
In regard to the dropdown height, I don't see any other way of specifying that other than the
cs.cy = 150;
setting in CMyCombo::PreCreate.
Your help is much appreciated.
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It was easy to alter the themes sample to replace the right-arrow button with the combo box, so that hiding any of the other buttons works in the proper way--closing the gap where the buttons were. Now I just have to duplicate that in my template application.
Fingers crossed,
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After just installing version 7.6 and compiling my template app, I thought you would like an update on some of the problems I was having with putting the combobox on the toolbar.
I find that the combo box can now be placed anywhere among the toolbar buttons and work successfully. However, there are still a few cosmetic problems if some of the toolbar buttons on either side are hidden. The combo box still operates (it didn't before), but it does not reposition correctly over a hidden button to the right, and it writes over the next visible button to the right when the button just on the right is hidden. I'm not sure these are appropriate concerns for Win32++, but, still, there should be some way the user can make this work.
Keep up the good work.
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If we hide a toolbar button (or do anything else which changes the toolbar layout), we need to recalculate the the combobox's position and move it with SetWindowPos. In CMainFrame::AddCombo, this is currently done like this:
// Determine the size and position of the ComboBox
int nIndex = pTB->CommandToIndex(IDM_FILE_SAVE);
CRect rc = pTB->GetItemRect(nIndex);
// Create and position the ComboboxEx window
m_ComboBoxEx.Create(pTB);
m_ComboBoxEx.SetWindowPos(NULL, rc, SWP_NOACTIVATE);
Note: If we are simply moving the ComboBox, we don't need to recreate it.
Best regards,
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi David,
in the sample dockcontainer the combobox does not show the 3 items dropdown.
regards
Euvi
Hi euvi,
Thanks for bringing this to my attention.
ComboBox and ComboBoxEx controls use the height specified when the control is created to determine the size of the dropdown list. Version 7.4 failed to set the height of ComboBoxEx control correctly, preventing the dropdown list from being displayed.
This problem has been fixed in SVN revision 1793.
Best regards,
David
Hi David,
I have downloaded version 7.5.1 and recompiled the themes sample using MinGW/DevC++ 32-bit debug mode, whereupon I find that the combo box works as advertised now. I then ported the MyCombo.h and .cpp files from that example into a program I am composing that has 24 x 24 bit toolbar buttons. I then compiled that program the same way as the themes sample. I now find that the combo box in my program is displaced left, halfway covering the IDM_FILE_OPEN button, and that the box down arrow does not cause the drop down display of the 3 items. Are there adjustments I need to make for 24 x 24 buttons?
Thanks,
Bob
I just now put the 16-bit button original toolbar back in my program and recompiled. I find the combo box is located correctly, but still does not drop down anything. I'll try to figure out what I'm doing differently in my program than in themes (which works correctly). Hmm.
I copied all the toolbars and code pertaining to the toolbars and combo boxes from themes, along with their IDs into my win32++ template application. So, since the dropdown in themes works, it should work in my app as well. But it doesn't. See attachment for comparative results. I'm still very baffled.
Bob
Hi Bob,
ComboBoxeEx controls are somewhat unusual in that we need to specify their full drop-down size when the window is created. This is a feature of the ComboBoxEx control itself.
When creating the control, we can specify its size in PreCreate. In the theme sample, it is done like this.
There are no "special" adjustments required for 24 x 24 buttons I'm aware of. Perhaps this is also related to the combobox's initial size setting.
Best regards,
David
Last edit: David 2014-09-12
I noticed that targetver.h for themes was set for Windows 98, so I changed it to XP, just to see if that made some difference. It did not. But as an experiment I changed targetver.h in my Win32++ Template app to 98, just to confirm it didn't make a difference. I recompiled everything, and lo and behold, the combo box in my app began to work. I changed it back to XP to see if it again would not work. But it still worked. I swear, these were the only changes I made, and the combo box now works as advertised! I have no idea why. I always do complete compilations when changes like this, or ones involving the .rc file, are made and it did not work until this. Miracles do happen in software, sometimes, I guess.
I was also able to replace the sample toolbar with my own with 20 24 x 24 buttons, and moved the combo box to a slot near the far right reserved for it. That worked fine, too. Then, I hid the box to its immediate left and recompiled. This time the screen showed a blank where the hidden button was, but now the combo box no longer worked.
I thought you might be interested in my progress. I am still discovering the wonder of Win32++. Thanks for your help, very much appreciated.
Bob
Hi Bob,
Good to see you're making progress.
It seems your compiler didn't recompile some of the code you changed. If in doubt, preforming a clean before the build will force a complete rebuild.
If you have access to it, Microsoft's Spy++ is a very handy utility for troubleshooting windows problems. It provides all sorts of information on each of the windows in the application. Spy++ ships with the full (but not express) versions of the Microsoft compilers. Trial versions of the full versions have Spy++ too.
Best of luck
David
David,
Yes, I guessed as much about the clean and recompiling a couple of times fixing that problem. Any theories why the combobox still fails to drop when preceded on the left by a hidden control button?
Thanks,
Bob
Hi Bob,
You should hide the toolbar button before adding the combo. If we hide the button after adding the combo, the position of the combo needs to be recalculated.
I know I mentioned this before, but the full height of the combobox, including its dropdown height, should be be specified in CMyCombo::PreCreate. The dropdown list won't be displayed unless this is done.
In the Theme sample, the combobox dropdown works properly when FileOpen button is hidden.
Best regards,
David
Thanks, Dave,
The neat thing about toolbar buttons is that you can hide those that don't apply at some stage of your application, and the toolbar closes up to show contiguously only those that you need. This presently screws up the combo box, so I should probably put it into a separate rebar. I think I'll try that.
In regard to the dropdown height, I don't see any other way of specifying that other than the
cs.cy = 150;
setting in CMyCombo::PreCreate.
Your help is much appreciated.
Bob
Dave,
It was easy to alter the themes sample to replace the right-arrow button with the combo box, so that hiding any of the other buttons works in the proper way--closing the gap where the buttons were. Now I just have to duplicate that in my template application.
Fingers crossed,
Bob
After just installing version 7.6 and compiling my template app, I thought you would like an update on some of the problems I was having with putting the combobox on the toolbar.
I find that the combo box can now be placed anywhere among the toolbar buttons and work successfully. However, there are still a few cosmetic problems if some of the toolbar buttons on either side are hidden. The combo box still operates (it didn't before), but it does not reposition correctly over a hidden button to the right, and it writes over the next visible button to the right when the button just on the right is hidden. I'm not sure these are appropriate concerns for Win32++, but, still, there should be some way the user can make this work.
Keep up the good work.
Bob
Hi Bob,
If we hide a toolbar button (or do anything else which changes the toolbar layout), we need to recalculate the the combobox's position and move it with SetWindowPos. In CMainFrame::AddCombo, this is currently done like this:
Note: If we are simply moving the ComboBox, we don't need to recreate it.
Best regards,
David