cancelBubble Property

Microsoft FrontPage Visual Basic

cancelBubble Property

Returns or sets a Boolean that represents whether the current event should bubble up the hierarchy of event handlers. True disables bubbling for this event, preventing the next event handler in the hierarchy from receiving the event.

expression.cancelBubble

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

Using this property to cancel bubbling for an event does not affect subsequent events.

Example

The following example displays a message when a user resizes the application window, and then cancels bubbling the event up the hierarchy of events if the user clicks the No button in the message box. This example must be placed in a class module.

Note  Place the winFP object variable declared with the WithEvents keyword in the General Declarations section of the class module.

Private WithEvents winFP As FPHTMLWindow2

Private Sub winFP_onresize()
    Dim objEvent As IHTMLEventObj
    Dim intResponse As Integer

    Set objEvent = window.event
    
    intResponse = MsgBox("Are you having fun?", vbYesNo)
    
    If intResponse = vbNo Then
        objEvent.cancelBubble = True
    Else
        objEvent.cancelBubble = False
    End If
End Sub