- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using a list control having a "list" style and it's populated with 6 items. I want to be able to have the first item in the list highlighted (preselected) when the user first sees the dialog. The following is the way I've been attempting to do this:
call PopulateList(GetDlgItem(hDlg,IDC_relop1),relops,6)
item%mask = LVIF_text
item%iItem = 0
item%state = LVIS_SELECTED
item%statemask = LVIS_SELECTED
iret = SendMessage(GetDlgItem(hDlg,IDC_relop1), & LVM_SETITEMSTATE,0,loc(item))
It doesn't do anything. What am I doing wrong?
With many thanks
Mike
call PopulateList(GetDlgItem(hDlg,IDC_relop1),relops,6)
item%mask = LVIF_text
item%iItem = 0
item%state = LVIS_SELECTED
item%statemask = LVIS_SELECTED
iret = SendMessage(GetDlgItem(hDlg,IDC_relop1), & LVM_SETITEMSTATE,0,loc(item))
It doesn't do anything. What am I doing wrong?
With many thanks
Mike
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mixed up ListView (the control in Explorer's list pane) and List control (standard list). LVM_SETITEMSTATE is used for the former (and even there, you need LVIF_STATE in the mask), and you appear to have used the latter.
Instead, you need LB_SETCURSEL (for single-selection list) or LB_SETSEL (for multiple-selection list).
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page