Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Modifying items in Combo Box

edsouzaedsouza Member Posts: 1
Is it possible to modify the text of items inside a Combo Box? I have a Combo Box in a modal dialog and a background thread which needs to modify the items in it as new information becomes available. The dialog is created as

[code]programNum =
DialogBoxParam(demux->hInst,
(LPCTSTR)IDD_MPTS_DIALOG,
demux->hMainWnd,
(DLGPROC)MPTS,
(LONG) &programs_ );[/code]

Inside the message loop for the dialog (in "case WM_TIMER:"), I pass the CB_SETITEMDATA message to the combo box like so:

[code]HWND list = GetDlgItem(hDlg, IDC_COMBO_MPTS);
res = SendMessage((HWND) list,
(UINT) CB_SETITEMDATA,
(WPARAM) 0,
(LPARAM) (LPCTSTR)"aaaaaaaa");[/code]

But, for some reason, the text in first item of the combo box never changes. I am able (in exactly the same spot in the code) to add items to the list with CB_ADDSTRING.

Reference: [link=http://msdn.microsoft.com/en-us/library/bb775792(VS.85).aspx]http://msdn.microsoft.com/en-us/library/bb775792(VS.85).aspx[/link]

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]The only way is to replace the item. Remove the item, then re-insert the new text. CB_SETITEMDATA works only for owner drawn combo boxes. In standard box, this message will only associate some 32-bit value to the item, but it will not change its text.[/color]
Sign In or Register to comment.