Event descriptions
OnContextMenu
Occurs when a context menu is invoked by the user right-clicking in the QlikView OCX control.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
1 | ContextObject | String | in | Unique ID of sheet object where context menu was requested. |
2 | ContextMenu | Long | in out | Reference to context menu. |
3 | OKToContinue | Integer | out | To be set to true if the built-in context menu is to be shown. |
Example of use (VB) :
Rem MenuDef.bas module:
Public Const MF_SEPARATOR = 2048
Public Const MF_STRING = 0
Declare Sub AppendMenu Lib "user32" Alias
"AppendMenuA" _
(ByVal hMenu _As Long, ByVal uFlags As
Long, _
ByVal uIDNewItem As Long, ByVal lpNewItem
As String)
Public Const MF_BYCOMMAND = 0
Public Const MF_BYPOSITION = 1024
Declare Sub DeleteMenu Lib "user32" (ByVal hMenu As
Long, _
ByVal uPosition As Long, ByVal uFlags As
Long)
Declare Function GetMenuItemCount Lib "user32" (ByVal
hMenu As Long) _
As Integer
Rem Form code:
Rem Module MenuDef.bas as above assumed available
Rem Module QVMenu.bas assumed available
Private Sub QlikOCX1_OnContextMenu(ByVal
ContextObject As String, _
ByVal ContextMenu As Long, OkToContinue As
Integer)
If ContextObject = "LB11" Then
Rem ** delete default menu command by
command **
Dim i, j
j = GetMenuItemCount(ContextMenu) - 1
For i = 0 To j
DeleteMenu ContextMenu, 0, MF_BYPOSITION
Next
Else
AppendMenu ContextMenu, MF_SEPARATOR, 0, 0
End If
Rem ** add new custom command to menu **
AppendMenu ContextMenu, MF_STRING, 45000,
"Confirmed Clear"
End Sub
Example of use (VC++) :
OnContextMenuCommand
Occurs when a context menu command is invoked in the QlikView OCX control.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
1 | ContextObject | String | in | Unique ID of sheet object where context menu was requested. |
2 | MenuCommand | Long | in, out | Context menu command ID. |
3 | OKToContinue | Integer | out | To be set to true if Menu- Command is to be executed by QV. |
Example of use (VB) :
Rem Form code:
Rem Module QVMenu.bas assumed available (QV constant
definitions)
Private Sub QlikOCX1_OnContextMenuCommand(ByVal
ContextObject As String,
MenuCommand As Long, OkToContinue As
Integer)
Dim MsgBoxResult
If MenuCommand = 45000 Then
MsgBoxResult = MsgBox("Do you really want to
clear?", vbYesNo)
If MsgBoxResult = vbYes Then
MenuCommand = ID_POPUP_CLEAR
OkToContinue = True
Else
OkToContinue = False
End If
End If
End Sub
Example of use (VC++) :
OnDataChanged
Occurs whenever the data or logical state changes in a QlikViewdocument, ie on selections, variable changes, after reload etc.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
- | - | - | - | No parameters. |
Example of use (VB) :
Private Sub QlikOCX1_OnMouseOver()
MsgBox("Hello!")
End Sub
OnHtmlHelp
Occurs when help is requested by pressing F1 or pushing the Help button in a dialog in the QlikView OCX control.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
1 | HelpData | Long | in | Identifies which item help is asked for. |
2 | HelpCommand | Integer | in | No parameters. |
3 | OKToContinue | Integer | out | To be set to true if Help is to be executed by QV. |
Example of use (VB):
Private Sub QlikOCX1_OnHtmlHelp(ByVal HelpData As
Long, ByVal HelpCommand As Integer, OkToContinue As
Integer)
Dim MsgBoxResult
MsgBoxResult = MsgBox("Do you really want to show
help for item " & HelpData & "?", vbYesNo)
If MsgBoxResult = vbYes Then
OkToContinue = True
Else
OkToContinue = False
End If
End Sub
OnMacro
Occurs when a macro trigger goes off in a QlikView document running in the QlikView OCX control.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
1 | MacroName | String | in | Name of macro invoked by trigger in QV document. |
2 | OKToContinue | Integer | out | To be set to true if VBScript macro in QV document is to be executed. |
Example of use (VB):
Private Sub QlikOCX1_OnMacro(ByVal MacroName As
String, OkToCont As Integer)
Dim MsgBoxResult
MsgBoxResult = MsgBox("Want to run macro '" &
MacroName & "'?", vbYesNo)
If MsgBoxResult = vbNo Then
OkToCont = False
End If
End Sub
Example of use (VC++):
OnMouseOver
Occurs once when mouse cursor is placed over OCX control area on screen.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
- | - | - | - | No parameters. |
Example of use (VB):
Private Sub QlikOCX1_OnMouseOver()
MsgBox("Hello!")
End Sub
OnQvEvent
Occurs as a result of a macro in a QV document executing FireQvEvent or FireQvUserEvent methods.
ParameterNo | Parameter | Type | Direction | Comment |
---|---|---|---|---|
1 | EventCategory | String | - | The EventCategory parameter of the Automation method FireQvEvent or the string '$user' after using the FireQvUserEvent. |
2 | EventSource | String | - | The EventSource parameter of the Automation methods FireQvEvent or FireQvUser- Event. |
Example of use (VB) :
Private Sub QlikOCX1_OnQvEvent()
End Sub
Private Sub QlikOCX1_OnQvEvent(ByVal EventCategory As
String, ByVal EventSource As String)
MsgBox (EventCategory + " - " + EventSource)
End Sub