VishalMistry
23rd September 2016, 12:40
hi all,
i have created a combo box (DsCdDComBox) using 3gl object. I am able to fill in the list but can't get the value of selected item.
Can anybody guide me how to get the value of selected value ? Also, how to get multiple selected values.
Vishal
bhushanchanda
23rd September 2016, 14:14
Here is a piece from the sample -
function handle.event.loop()
{
long event(EVTMAXSIZE)
while TRUE
next.event(event)
on case evt.type(event)
case EVTMENUSELECT:
on case evt.menu.return(event)
case COMMAND.ABORT:
case COMMAND.EXIT:
return
case COMMAND.FIRST:
combox_id = 1
update.gwindow()
break
case COMMAND.LAST:
combox_id = 5
update.gwindow()
break
case COMMAND.PREV:
if combox_id > 1 then
combox_id = combox_id - 1
update.gwindow()
endif
break
case COMMAND.NEXT:
if combox_id < 5 then
combox_id = combox_id + 1
update.gwindow()
endif
break
endcase
break
case EVTPUSHBUTTON:
if ( evt.button.return(event) = COMMAND.ABORT OR
evt.button.return(event) = COMMAND.EXIT ) then
return
endif
break
case EVTLISTBOXSELECT:
combox_id = evt.listbox.item_id(event)
update.gwindow()
break
default:
break
endcase
endwhile
}
So, you get the current selected ID using
combox_id = evt.listbox.item_id(event)
Now, you need to set the value using -
change.object(combox, DsNselectedId, combox_id)
Regarding multiple selections, I think its only allowed with DsClistBox
DsNallowMultiSelection
(long)
[CG]
DsClistBox objects only.
Indicates whether a user can select more than one item. Possible values are:
TRUE Multiselection permitted.
FALSE Multiselection not permitted (default).