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

Using Modeless dialog boxes

Luigino86
Beginner
701 Views
Hi there,
I have some problems using modeless dialog boxes with QuickWin applications...I'm just a beginner...I read all the post as concerning that matter...but I couldn't find the answer...I'd like to ask you a little sample code and I would appreciate it very much
Kind regards
Luigi
0 Kudos
2 Replies
anthonyrichards
New Contributor III
701 Views
Quoting - luigino86
Hi there,
I have some problems using modeless dialog boxes with QuickWin applications...I'm just a beginner...I read all the post as concerning that matter...but I couldn't find the answer...I'd like to ask you a little sample code and I would appreciate it very much
Kind regards
Luigi


Please give some information about the problem you are having with a modeless dialog, then we might be able to help. Are you using code such as the following?

! Include the constants provided by the Resource Editor
include 'resource.fd'

! A dialog box callback
external ThermometerSub

! Variables
type (dialog) dlg
type (T_MSG) mesg
integer(4) ret
logical(4) lret

! Create the thermometer dialog box and set up the controls and callbacks
lret = DlgInit(IDD_THERMOMETER, dlg_thermometer)
lret = DlgSetSub(dlg_thermometer, IDD_THERMOMETER, ThermometerSub)
lret = DlgSet(dlg_thermometer, IDC_PROGRESS1, 32, DLG_RANGEMIN)
lret = DlgSet(dlg_thermometer, IDC_PROGRESS1, 212, DLG_RANGEMAX)
lret = DlgSet(dlg_thermometer, IDC_PROGRESS1, 32)
lret = DlgModeless(dlg_thermometer, nCmdShow)

! Read and process messages until GetMessage returns 0 because
! PostQuitMessage has been called
do while( GetMessage (mesg, NULL, 0, 0) )
! Note that DlgIsDlgMessage must be called in order to give
! the dialog box first chance at the message.
if ( DlgIsDlgMessage(mesg) .EQV. .FALSE. ) then
lret = TranslateMessage( mesg )
ret = DispatchMessage( mesg )
end if
end do

! Cleanup dialog box memory
call DlgUninit(dlg)

0 Kudos
Jugoslav_Dujic
Valued Contributor II
701 Views
Quoting - luigino86
Hi there,
I have some problems using modeless dialog boxes with QuickWin applications...I'm just a beginner...I read all the post as concerning that matter...but I couldn't find the answer...I'd like to ask you a little sample code and I would appreciate it very much
Kind regards
Luigi

You can use modeless dialog boxes with QuickWin, under the following restrictions:

1) The dialog must be launched from a menu or mouse callback routine (or any of its called routines), or anywhere else from the primary thread. It will not work if it's called from QuickWin PROGRAM (or any of its called routines).

2) Shortcut keys will not work in any case (Esc for Cancel, Enter for OK, Alt+Letter modifiers).

There are means to work around those, but they're fairly complex for a beginner.

Edit: it will also work if it's launched from a callback routine of another modal dialog. Not sure about shortcut keys in that case.
0 Kudos
Reply