Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29295 Discussions

Wanting to "hybridize" the standard ComboBox as a control; any ideas?

TommyCee
Beginner
868 Views
As most of you know, for the standard ComboBox has 3 Types (modes):
  1. Simple
  2. Dropdown
  3. Drop List
1&2 are both editable and only differ in the way the choices are displayed (Simple exposes all choices; Dropdown hides them until the dropdown list is clicked).

In this latter sense (display of choices), 2&3 are identical but the choices for 3 are fixed (i.e., not editable).

In my case, I have an input variable that takes on one of two modes in terms of choices:
A) a fixed value (hardwired; user cannot alter).
B) some editable (adjustable) value - presented in an edit box that the user can change.

For A, #3 (Drop List) would be ideal; for B, #2 (Dropdown) would be ideal.

This is actually very common in dialogs you see used in a variety of apps. in which a list may provide a series of "fixed" choices, and then a last one [e.g., Other (please specify)] - the "please specify" is editable. I believe Delphi allows one to configure this way fairly easily.

For CVF or IVF, I wonder if there is any way to configure either the ComboBox in the Resource Editor itself, or some trick coding using (for example) DlgSet, etc. to accomplish this.

Any help is appreciated.

p.s.
The so-called "Extended" ComboBox in the Resource Editor is of no help in overcoming this obstacle.
0 Kudos
5 Replies
anthonyrichards
New Contributor III
868 Views
I would say that you want to set up an unsorted list in your combo box, with the editable entry's location permanently set so that when you select a list item whose index does not match the editable entry's index, you can disable the edit boxselection so that it cannot be edited. You can get the handle to theedit control portion of a ComboBoxEx control by sending it the CBEM_GETEDITCONTROL message with parameters wParam = 0, lParam = 0 using the Windows API function SendMessage, using the handle to the Combobox.
e.g.

USE DFWINTY ! contains definitions of window messages such as CBEM_GETEDITCONTROL
Integer(handle) hEditControl, hComboWnd
hEditControl= SendMessage(hComboWnd, & handle of combo box
CBEM_GETEDITCONTROL , & message to send
0, & first message parameter
0 &second message parameter)




0 Kudos
TommyCee
Beginner
868 Views
Quoting - anthonyrichards
I would say that you want to set up an unsorted list in your combo box, with the editable entry's location permanently set so that when you select a list item whose index does not match the editable entry's index, you can disable the edit boxselection so that it cannot be edited. You can get the handle to theedit control portion of a ComboBoxEx control by sending it the CBEM_GETEDITCONTROL message with parameters wParam = 0, lParam = 0 using the Windows API function SendMessage, using the handle to the Combobox.
e.g.

USE DFWINTY ! contains definitions of window messages such as CBEM_GETEDITCONTROL
Integer(handle) hEditControl, hComboWnd
hEditControl= SendMessage(hComboWnd, & handle of combo box
CBEM_GETEDITCONTROL , & message to send
0, & first message parameter
0 &second message parameter)





Thanks Anthony. You seem to be on the right track, if I could only get the coding apparatus figured out. I'll have to study and ponder your suggestion (which, btw, is consistent w/ what I see posted here: http://msdn.microsoft.com/en-us/library/bb775772%28VS.85%29.aspx).

I gather that the "Type" to be selected in the Extended ComboBox is DropDown (?).

I'll post back if I get hung up.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
868 Views
Quoting - tommycee

Thanks Anthony. You seem to be on the right track, if I could only get the coding apparatus figured out. I'll have to study and ponder your suggestion (which, btw, is consistent w/ what I see posted here: http://msdn.microsoft.com/en-us/library/bb775772%28VS.85%29.aspx).

I gather that the "Type" to be selected in the Extended ComboBox is DropDown (?).

I'll post back if I get hung up.

If you don't want to use ComboBoxEx, (for example, because it's not supported by IFLOGM), I suggest the following technique on the plain ComboBox (untested):

  • Use the dropdown combo
  • Find the window of the edit box child window of the combo (hEdit = FindWindow("Edit"//char(0), NULL))
  • Toggle the read-only flag of the edit control using EM_SETREADONLY.
0 Kudos
GVautier
New Contributor III
868 Views
Hello

You can also use the CB_GETCOMBOBOXINFO message. The hwndItem member of the returned GETCOMBOBOXINFO structure contains the edit box window handle.

See :
http://msdn.microsoft.com/en-us/library/bb775839%28VS.85%29.aspx
0 Kudos
TommyCee
Beginner
868 Views

This is a belated reply to all of the above (including Anthony & Jugoslav):

Anthony suggests an unsorted Extended ComboBox. Firstly, as I see it, the Extended ComboBox (for mysterious reasons) does not lend itself to use of commands like DlgSet under dfLOGM. Secondly, he suggests the following code to define the handle:


[bash]hEditControl= SendMessage(hComboWnd, & handle of combo box
CBEM_GETEDITCONTROL ,   & message to send
0,    & first message parameter
0     & second message parameter)[/bash]

but unfortunately, I have no idea what to do w/ that handle (sorry to be so thick). I would need a little more help to be convinced this would work (perhaps a simple exemplar project could be attached - I'd love to see it).

Jugoslav echoes my first point (above) and then suggests to:

  • Use the dropdown combo
  • Find the window of the edit box child window of the combo (hEdit = FindWindow("Edit"//char(0), NULL))
  • Toggle the read-only flag of the edit control using EM_SetReadOnly.

Again, for me this leaves too much for the imagination. I've tinkered w/ this for hours, stared as MSDN articles, and cannot seem to get anything to work (probably don't have the code set up completely).

BVautier's comments are much appreciated. He mentions yet another approach (CB_GETCOMBOBOXINFO message) and that the "hWndItem member of the returned GetComboBoxInfo structure contains the edit box window handle." I have no idea what to do w/ this "edit box window handle" contained in the returned structure.

I appreciate all the suggestions but I'd need to (please) see a complete module for one such ComboBox to be convinced that the hybridization I seek is really possible. I remain skeptical and this notion may be a bit too academic.

0 Kudos
Reply