subroutine Read_List(dlg, id, callbacktype)
use dflogm
use dfwin

include 'resource.fd'

type(dialog) dlg
integer id, callbacktype
logical retlog

integer ivalue

character(10) value

character(40) New_Item 

logical get_index



select case(id)


case(idc_Radio1)
get_index =.true.


case(idc_Radio2)
get_index =.false.


case(idc_List1)
retlog =DlgSet(dlg, idc_Static_Result, 'List-1')

! For the case no Radio Button has been pushed:
retlog =dlgGet(dlg, idc_Radio1, get_index)

if(get_index) then
! Get Selection Index:
retlog =dlgGet(dlg, idc_List1, ivalue, 1)
write(value, '(I1)')  ivalue

else
! Get Selection String
retlog =dlgGet(dlg, idc_List1, value)
endif

retlog =DlgSet(dlg, idc_Edit1, trim(value))


case(IDC_CHECK_Add)
retlog =dlgset(dlg, idc_Edit_Add, .true., dlg_enable)

retlog =dlgset(dlg, idc_Button_Done, .TRUE., dlg_enable)


case(idc_Button_Done)
retlog =dlgGet(dlg, idc_Edit_Add, New_Item, dlg_state)

retlog =dlgSetChar(dlg, idc_List1, trim(New_Item), dlg_addstring)

retlog =dlgset(dlg, IDC_CHECK_Add, .false., dlg_state)

retlog =dlgSet(dlg, idc_Edit_Add, '')

retlog =dlgset(dlg, idc_Edit_Add, .false., dlg_enable)

retlog =dlgset(dlg, idc_Button_Done, .false., dlg_enable)

case(idc_Combo1)
retlog =DlgSet(dlg, idc_Static_Result, 'Combo-1')

retlog =dlgGet(dlg, idc_Radio1, get_index)

if(get_index) then
retlog =dlgGet(dlg, idc_Combo1, ivalue, dlg_state)
write(value, '(I1)')  ivalue

else
retlog =dlgGet(dlg, idc_Combo1, value)
endif


retlog =DlgSet(dlg, idc_Edit1, trim(value))


case(idc_Combo2)
retlog =DlgSet(dlg, idc_Static_Result, 'Combo-2')


retlog =dlgGet(dlg, idc_Combo2, value)

retlog =DlgSet(dlg, idc_Edit1, trim(value))

case default
retlog =DlgSetChar(dlg, idc_Edit1, '0')

end select



end subroutine Read_List
