Qlik Community

QlikView Integration

Discussion Board for collaboration on QlikView Integration.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

How to add to a Right-Click Menu Item in the OCX

Adding a MenuItem to the right click context menu of a object in QlikView is not documented.

and you can cancel the contextMenu action by setting e.okToContinue =0

c# code.

  [Flags]

public enum MenuFlags : uint

{

     MF_STRING = 0,

     MF_BYPOSITION = 0x400,

     MF_SEPARATOR = 0x800,

     MF_REMOVE = 0x1000,

}

[DllImport("user32.dll", CharSet = CharSet.Auto)]

static extern bool AppendMenu(IntPtr hMenu, MenuFlags uFlags, uint uIDNewItem, string lpNewItem);

'add this to after your InitializeComponent in your form or use the event properties in the designer.           

this.axQlikMainApp.OnContextMenu += new AxQlikOCXLib._DQlikOCXEvents_OnContextMenuEventHandler

     (this.axQlikMainApp_OnContextMenu);

           

this.axQlikMainApp.OnContextMenuCommand += new AxQlikOCXLib._DQlikOCXEvents_OnContextMenuCommandEventHandler

     (this.axQlikMainApp_OnContextMenuCommand);

//Here we are adding to the menu.

private void axQlikMainApp_OnContextMenu(object sender, AxQlikOCXLib._DQlikOCXEvents_OnContextMenuEvent e)

{

     var x = new IntPtr(e.contextMenu);

        AppendMenu(x, MenuFlags.MF_STRING, 2, "This is a new menu");

}

//This is the event that is raised by all of the commands.

private void axQlikMainApp_OnContextMenuCommand(object sender, AxQlikOCXLib._DQlikOCXEvents_OnContextMenuCommandEvent e)

{

    if(e.menuCommand == 8000)

        MessageBox.Show("New menu clicked");

}

Tags (2)
Community Browser