- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In a dialog application, when a single-selection list-box is populated with a list of items and displayed, no particular item is initially selected and shown highlighted. Is it possible toselect and highlight an item on command from within the program displaying the list without the user having to mouse-click on the list?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Show, yes, but highlight, I don't know!
I use SetDlgItemText to show a default value in a combo box in a QuickWin application. Look at the sample program CelsiCon. (This sample exists in CVF package. I don't know if IVF has it)
Sabalan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I think next code should work:
if (callbacktype == dlg_init) then
retlog = DlgSet ( dlg, IDC_LIST1, 3, DLG_NUMITEMS )
retlog = DlgSet ( dlg, IDC_LIST1, "prvni", 1 )
retlog = DlgSet ( dlg, IDC_LIST1, "druha",2 )
retlog = DlgSet ( dlg, IDC_LIST1, "treti", 3 )
CALL DlgFlush(dlg)
retlog = SendMessage(GetDlgItem(Dlg%hWnd,IDC_LIST1),LB_SETCURSEL,1,0)
ENDIF
Items in listbox are zero-based so the second item (druha) should be selected. I am not sure how clean it is (call dlgflush within dlg_init), but it works for me (MSVS .NET2003 + IVF8).
I think next code should work:
if (callbacktype == dlg_init) then
retlog = DlgSet ( dlg, IDC_LIST1, 3, DLG_NUMITEMS )
retlog = DlgSet ( dlg, IDC_LIST1, "prvni", 1 )
retlog = DlgSet ( dlg, IDC_LIST1, "druha",2 )
retlog = DlgSet ( dlg, IDC_LIST1, "treti", 3 )
CALL DlgFlush(dlg)
retlog = SendMessage(GetDlgItem(Dlg%hWnd,IDC_LIST1),LB_SETCURSEL,1,0)
ENDIF
Items in listbox are zero-based so the second item (druha) should be selected. I am not sure how clean it is (call dlgflush within dlg_init), but it works for me (MSVS .NET2003 + IVF8).
Message Edited by majsta on 08-12-2004 01:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is a pleasure to reply that it works for me too - exactly as I wanted! Many thanks for your help. (I am using CVF 6.6C, MS windows 2000)
Message Edited by anthonyrichards on 08-12-2004 05:54 AM

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