Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
I need to extend wxComboBox (or develop a combobox-like control) so that I can add one or more thin separator lines between choices, very much like the below:
comboWithSep.jpg
Details:
I am using wxWidgets 3.0.2, and have no options to use any other version (this is an existing software project with many other dependencies)
I am relatively new to wxWidgets but reasonably knowledgable in C++
The combo box is text-only and does not need icons or other decorative enhancements
I need to build for Windows 7/8.1/10 and Mac OSX 10.x, but not other OSes
I've seen conflicting information as to whether I should overload the OnPaint event handler or not.
Regardless of how I implement this, I need to avoid any labor-intensive approaches if possible.
I would value your recommendations and suggestions!
You do not have the required permissions to view the files attached to this post.
Just be aware that IIRC wxComboCtrl (at least on MSW) does not behave like a wxComboBox. For example, there is no support for navigating the items with keyboard at all, i.e. selecting items with cursor keys (Up, Dn, PgUp, PgDn, Home, End) or by typing their first few letters or even closing the pop-up with Esc/Enter etc. All this must be implemented anew (aka copied from wxComboBox).
Maybe just using a regular menu (perhaps something like this) instead may be a better idea...
PB wrote:Maybe just using a regular menu (perhaps something like this) instead may be a better idea...
Very clever! And it would certainly get me the dividing lines, since menus in both OSX and MSW have them.
Are you saying that I should use the menu for my popup section but build the rest of the control myself, as was done with your SplitButton example? (Obviously using an edit control or whatever so my version looks like a combo box.)
How would doing that differ from using wxComboCtrl, but wrapping the menu object in a class derived from wxComboPopup?
(The existing combo box in the app I"m working on allows you to all the keyboard actions you described; I'm adding an MRU list section to the combo box, and I'm guessing the product manager won't want to lose functionality to gain the divider bar and the MRU.)
I actually meant using just a pop-up menu with another control as the easiest way to do that. If the control has to look and behave like a combox, you cannot do that then.