Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

This is for Compaq Visual Fortran (v6x):

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, 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.

The so-called "Extended" ComboBox in the Resource Editor is of no help in overcoming this obstacle.

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

The only way I know of is to overlay another editable window which is the same size as the combo box on top of the combo box.  When the user presses return, the new option is added to the combo box.

The overlaid box is quite painful to program and debug.  You also need to close it immediately you lose focus otherwise it gets left behind when the dialog moves.

Easiest to use 2 machines to debug this - once you lose focus and go into the debugger, strange things happen.

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

Thanks XWB.  Your "solution" seems a bit complicated (as you admitted) and tenuous.  Here's a response I got on an IVF forum; what do you think?

I would say that you want to set up an unsorted list in your ComboBox, 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 box selection so that it cannot be edited. You can get the handle to the edit 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.

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)

This is consistent with the description for CBEM_GetEditControl Message posted here:

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

That would work but like my method, you have to monitor when it goes out of focus and EnableWindow TRUE or FALSE accordingly.

Basically, you need to be as warped as your users and handle all the weird stuff they will do like typing half way and then changing their mind and going back to the drop down list.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close