Share this page

# Check if a Dialog Box is Open

It is helpful to track whether a dialog box is open before performing certain actions. For example:

- Dialog boxes do not need to be refreshed but grid displays do.

- Certain workflow events are not allowed when a dialog box is open.

The DialogBox event can be used to track the visibility of dialog boxes.

## Recommendations

To avoid unpredictable results, determine if a dialog box is open before any events occur.

The following example checks whether the dialog box for creating a new defect is open. This is relevant because the `BG_USER_01` field can only be modified for a new defect. If a different dialog box is open, such as the dialog box for editing a defect, the `BG_USER_01` field cannot be modified.

Example:

    ' Declare a global variable for each dialog box of interest
    Dim NewDefectDialogIsOpen
    ' Initialize the global variable
    NewDefectDialogIsOpen = False
    Sub DialogBox(DialogBoxName, IsOpen)
        If DialogBoxName="New Bug" Then
            NewDefectDialogIsOpen = True
        Else
            NewDefectDialogIsOpen = False
        End If
    End Sub
    Function Bug_FieldCanChange(FieldName, NewValue)
    ' Initialize the function's return value to avoid
    ' unpredictable behavior.
    Bug_FieldCanChange = True
    ' The BG_USER_01 field can only be modified for a new defect.
    If FieldName="BG_USER_01" Then
        If NewDefectDialogIsOpen Then
            Bug_FieldCanChange = True
        Else
            Bug_FieldCanChange = False
        End If
    End If
    End Function

Back to top

https://admhelp.microfocus.com ALM 8942
Tips to improve your search results... ALM Help Center ALM Help Center ALM Help 15.5-15.5.1 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: