# DLGFLUSH (W*S)

Dialog Subroutine: Updates the display of a dialog box.

## Module

USE IFLOGM

CALL DLGFLUSH (dlg[,flushall])

dlg | (Input) Derived type `dialog`. Contains dialog box parameters. The components of the type `dialog` are defined with the PRIVATE attribute, and cannot be changed or individually accessed by the user.
flushall | (Input; optional) Logical. If .FALSE. (the default), then only the controls that the dialog routines have marked as changed are updated. If .TRUE., all controls are updated with the state of the controls as known by the dialog routines. Normally, you would not set flushall to .TRUE..

When your application calls DLGSET to change a property of a control in a dialog box, the change is not immediately reflected in the displayed dialog box. Changes are applied when the dialog box is first displayed, and then after every dialog callback to the user's code.

This design expects that, after a call to DLGMODAL or DLGMODELESS, every call to DLGSET will be made from within a callback routine, and that the callback routine finishes quickly. This is true most of the time.

However, there may be cases where you want to change a control outside of a dialog callback, or from within a loop in a dialog callback.

In these cases, DLGFLUSH is required, but is not always sufficient, to update the dialog display. DLGFLUSH sends pending Windows* system messages to the dialog box and the controls that it contains. However, many display changes do not appear until after the program reads and processes these messages. A loop that processes the pending messages may be required; for example:

    use IFWINTY
    use USER32
    use IFLOGM
    logical lNotQuit, lret
    integer iret
    TYPE (T_MSG) mesg
    lNotQuit = .TRUE.
    do while (lNotQuit .AND. (PeekMessage(mesg, 0, 0, 0, PM_NOREMOVE) <> 0))
      lNotQuit = GetMessage(mesg, NULL, 0, 0)
        if (lNotQuit) then
          if (DLGISDLGMESSAGE(mesg) .EQV. .FALSE) then
             lret = TranslateMessage(mesg)
             iret = DispatchMessage(mesg)
          end if
        end if
    end do

Parent topic: Dialog Library Routines

## See Also

DLGINIT
DLGMODAL
DLGMODELESS
DLGSET
DLGSETSUB