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.
29280 Discussions

Retrieving selected items in a list box

Intel_C_Intel
Employee
410 Views
I'm struggling withmy firstlist box. I get the dialog box open (contains just one list box, multiple selection mode) andget it populated just fine.
But after returning from dlgmodal, everything appears selected, e.g.

j = 1
test = -1

DO WHILE (test .NE. 0)
retlog = DLGGET (dlg2, IDC_NAMES, TEMP, j)
test = J
j = j + 1
END DO

returns every item in the list, regardless of selection. Must be something simple I'm missing. In fact, after the last item of the list returns, test continues to increment forever, even beyond the max number of items (1000)in the list. Retlog is false after the last populated entry as it should be)

Please help!

TIA

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
410 Views
4th argument of DlgGet is always INTENT(in) -- i.e. unchanged -- so your test to zero will always fail. For retrieveal of selection, 3rd argument should be integer, (which is INTENT(out)); its output value is index of n-th selected item, where n is value of 4th argument. Thus:
j = 1
DO WHILE (iTemp .NE. 0)
IF (DlgGet (dlg2, IDC_NAMES, iTemp, j)) THEN
!j-th selected string is iTemp-th in the list:
retlog = DlgGet(Dlg2, IDC_NAMES, sItem, iTemp)
!Do something with sItem (string)
END IF
j = j + 1
END DO

Jugoslav

0 Kudos
Intel_C_Intel
Employee
410 Views

Thanks! Solved the problem for me. I was trying to follow the example in the docs and couldn't get it to work.

Neal

0 Kudos
Reply