setting edit text of combox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divideby0
    New Member
    • May 2012
    • 131

    setting edit text of combox

    Is it possible to set the edit text portion of a combo box programmaticall y? I'm not processing any user entered text.

    I'm using C and WinAPI only - no MFC or stuff like that.

    Code:
    hndCombo = CreateWindow(...,
               WS_CHILD | WS_VISIBLE | WS_TAPSTOP |
               CBS_HASSTRINGS | CBS_DROPDOWNLIST,
               ...);
    Stuff I've tried that doesn't work

    Code:
    SetWindowText(hndCombo, ...);
    SetDlgItemText(parent, id_combo, ...);
    SendMessage(hndCombo, WM_SETTEXT, 0, (LPARAM)...);
    If that isn't possible, can I limit the number of strings displayed in the dropdown so that I can add the "display" text to the end of the list and just use

    Code:
    drop down list
    "option 1"
    "option 2"
    "option 3"  stop showing here
    "display text but invisible to user"
     
    SendMessage(hndCombo, CB_SETCURSEL, 3, 0);
    Thanks in advance
Working...