subroutine DoDialog(dlg, id, callbacktype)
use dflogm
use dflib
!use dfwin

include 'resource.fd'

type(dialog) dlg
integer id, callbacktype
logical retlog
integer retint
external Read_List
character(10) string


! Initialize:
retlog =dlginit(idd_dialog1, dlg)

! Set Callbacks:
retlog =dlgsetsub(dlg, idc_List1, Read_List)

retlog =dlgsetsub(dlg, IDC_CHECK_Add, Read_List)
retlog =dlgsetsub(dlg, idc_Edit_Add, Read_List)
retlog =dlgsetsub(dlg, idc_Button_Done, Read_List)



retlog =dlgsetsub(dlg, idc_Radio1, Read_List)
retlog =dlgsetsub(dlg, idc_Radio2, Read_List)

retlog =dlgsetsub(dlg, idc_Combo1, Read_List)		! Drop List

retlog =dlgsetsub(dlg, idc_Combo2, Read_List, dlg_selchange)		! Simple
retlog =dlgsetsub(dlg, idc_Combo2, Read_List, dlg_update)

retlog =dlgsetsub(dlg, idc_Edit1, Read_List)

! Set up Radio:
retlog =dlgset(dlg, idc_Radio1, .true.)

! Set up Lists:
retlog =dlgset(dlg, idc_List1, 5, dlg_numitems)

do i =1,5

write(string, '(I1)')  i
retlog =dlgset(dlg, idc_List1, trim(string), i)

enddo

! Add new item:
retlog =dlgset(dlg, IDC_CHECK_Add, .false., dlg_state)

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



retlog =dlgset(dlg, idc_Combo1, 3, dlg_numitems)
retlog =dlgset(dlg, idc_Combo1, "A Item", 1)
retlog =dlgset(dlg, idc_Combo1, "B Item", 2)
retlog =dlgset(dlg, idc_Combo1, "C Item", 3)


! Force initial selection:
retlog =DlgSet(dlg, idc_List1, 2, 1)

retlog =DlgSetInt(dlg, idc_Combo1, 3, dlg_state)


retint =dlgmodal(dlg)

call dlguninit(dlg)

end subroutine DoDialog
