Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

PROGRAMMED LIST-BOX SELECTION

anthonyrichards
New Contributor III
648 Views
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?
0 Kudos
3 Replies
sabalan
New Contributor I
648 Views
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.
0 Kudos
meistrv
Beginner
648 Views
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).

Message Edited by majsta on 08-12-2004 01:24 PM

0 Kudos
anthonyrichards
New Contributor III
648 Views
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

0 Kudos
Reply