Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

DLGSETSUB won't work with drop-down box

nvaneck
New Contributor I
514 Views

Is this a bug, artifact, or is there some way to get it to work. When the box is a straight edit box, it works as it ahould. The documentation states "You can also associate more than one callback routine with the same control, but you must use then use index parameter to indicate which callback routine to use.", but this doesn't work when I set index to 2. Is there an index value that would do it?

Throughout my project, a ? is used to generate a pick list for various edit controls, but with the four places I need to use a drop down list, I can't get it to work.

0 Kudos
2 Replies
anthonyrichards
New Contributor III
514 Views
Some of the code for DlgSetSub taken from DFLOGM that uses the index looks like this (idx being the optional index value)

recursive function DlgSetSub( dlg, controlid, value, index ) result
!DEC$ ATTRIBUTES DEFAULT :: DlgSetSub
type (dialog), intent(inout) :: dlg
integer, intent(in) :: controlid
external value
integer, optional, intent(in) :: index
logical r
integer i, idx
if ( present(index) ) then
idx = index
else
idx = dlg_default
end if
...
...
if ( idx .eq. dlg_clicked .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_checkbox)
if ( idx .eq. dlg_clicked .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_radiobutton)
if ( idx .eq. dlg_clicked .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_edit)
if ( idx .eq. dlg_change .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
else if (idx .eq. dlg_update) then
dlg % list(i) % callbackvalue(2) = loc(value)
r = .true.
else if (idx .eq. dlg_gainfocus) then
dlg % list(i) % callbackvalue(3) = loc(value)
r = .true.
else if (idx .eq. dlg_losefocus) then
dlg % list(i) % callbackvalue(4) = loc(value)
r = .true.
end if
case (ctrl_scrollbar)
if ( idx .eq. dlg_change .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_listbox)
if ( idx .eq. dlg_selchange .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
else if (idx .eq. dlg_dblclick) then
dlg % list(i) % callbackvalue(2) = loc(value)
r = .true.
end if
case (ctrl_combobox)
if ( idx .eq. dlg_selchange .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
else if (idx .eq. dlg_dblclick) then
dlg % list(i) % callbackvalue(2) = loc(value)
r = .true.
else if (idx .eq. dlg_update) then
dlg % list(i) % callbackvalue(3) = loc(value)
r = .true.
else if (idx .eq. dlg_change) then
dlg % list(i) % callbackvalue(4) = loc(value)
r = .true.
else if (idx .eq. dlg_gainfocus) then
dlg % list(i) % callbackvalue(5) = loc(value)
r = .true.
else if (idx .eq. dlg_losefocus) then
dlg % list(i) % callbackvalue(6) = loc(value)
r = .true.
end if
case (ctrl_droplist)
if ( idx .eq. dlg_selchange .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
else if (idx .eq. dlg_dblclick) then
dlg % list(i) % callbackvalue(2) = loc(value)
r = .true.
end if
case (ctrl_spinner)
if ( idx .eq. dlg_change .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_slider)
if ( idx .eq. dlg_change .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
end if
case (ctrl_tab)
if ( idx .eq. dlg_selchange .or. idx .eq. dlg_default ) then
dlg % list(i) % callbackvalue(1) = loc(value)
r = .true.
else if ( idx .eq. dlg_selchanging ) then
dlg % list(i) % callbackvalue(2) = loc(value)
r = .true.
end if
case (ctrl_activex)
case default
!DEC$ IF defined(DEBUG)
stop "assert in module dialogm"
!DEC$ ENDIF
end select
end function DlgSetSub

So you see the 'index' is not just sequence number but associates a particular callback routine (value) with a particular dlg_(whatever) value supplied as the 'index'. Particular types of controls allow the use of a particular set of dlg_(whatever) values. See 'Dialog control indexes' in the help. The pre-defined indexes given in the module DFLOGMT (in DFLOGM.f90) are

! predefined index values for Get/Set functions
integer, parameter, public :: dlg_init = 0
integer, parameter, public :: dlg_default = -1
integer, parameter, public :: dlg_title = -2
integer, parameter, public :: dlg_enable = -3
integer, parameter, public :: dlg_clicked = -4
integer, parameter, public :: dlg_state = -5
integer, parameter, public :: dlg_change = -6
integer, parameter, public :: dlg_update = -7
integer, parameter, public :: dlg_range = -8
integer, parameter, public :: dlg_rangemax = -8
integer, parameter, public :: dlg_position = -9
integer, parameter, public :: dlg_selchange = -10
integer, parameter, public :: dlg_bigstep = -11
integer, parameter, public :: dlg_smallstep = -12
integer, parameter, public :: dlg_numitems = -13
integer, parameter, public :: dlg_dblclick = -14
integer, parameter, public :: dlg_destroy = -15
integer, parameter, public :: dlg_rangemin = -16
integer, parameter, public :: dlg_tickfreq = -17
integer, parameter, public :: dlg_gainfocus = -18
integer, parameter, public :: dlg_losefocus = -19
integer, parameter, public :: dlg_selchanging = -20
integer, parameter, public :: dlg_addstring = -21
integer, parameter, public :: dlg_textlength = -22
integer, parameter, public :: dlg_idispatch = -23
integer, parameter, public :: dlg_sizechange = -24


0 Kudos
nvaneck
New Contributor I
514 Views
Thanks.

There doesn't seem to be anything in the dialog overview and explanations I can find that helps. There is only one call back routine set for the drop-down list box. It is never called, whether no index argument, or index set to DEL_SELCHANGE, OR DLG_DBLCLICK which are allowed for a dropdown list.

Nothing is in the tables for DLGSETSUB, except under DLGSETSUB it says you can use an index for a second call, but there is no explantion of the index there and there is NO call to the DLGSETSUB routine at all when a character is typed.

I'm hoping I'm missing something here, as there is no satisfactory way to do this I can find. What I want to happen is to allow a selection from the list, or to type in something new--all of which works fine. But I also want to invoke the callback routine when something new, e.g., a "?", is typed.
0 Kudos
Reply