2 Replies Latest reply: Oct 20, 2011 11:30 AM by farndt RSS

    From OnActivateMacro to OnActivateActionItems using charts

      Hi,

      I'm trying to migrate a version 7.52 document to version 10.
      The document contains a VBScript line
      prop.GraphLayout.Frame.OnActivateMacro = "MacrosName"
      that causes a problem saying the the object doesn't support property or method: 'prop.GraphLayout.Frame.OnActivateMacro'

      Obviously there were some changes and now ActionItems have to be used.
      To get some understanding I copied code from the API Guide and modified it. Using a list box object everything seems to work fine. Using a chart object (pivot table) as I will eventually need to I'm told 'prop.Layout' is not supported.

       

       

      sub actionItemsOfListBox
       set myobject = ActiveDocument.GetSheetObject("LB27")
       set prop = myobject.GetProperties
       set actions = prop.Layout.Frame.OnActivateActionItems
       for i=0 to actions.Count-1
        msgbox "Action types: " & actions.item(i).Type
       next
      end sub
      

       

      So I tried a second example from the API Guide which works fine for charts but no ActionItems are shown although there is a trigger defined for the chart in the sheet properties.

       

      I guess I'm looking in the wrong place. Maybe OnActivateActionItems ist not the right method for what I want to do? But then it seems to be ok for list boxes.

      Yes, I looked at the postings in this forum but I couldn't find the answer to my problem. At least none I understood.

       

      Can you help?

       

      Thanks

       

      Franziska

      sub actionItemsOfChart
       set MyGraph = ActiveDocument.GetSheetObject("8+CH491GENERIC")
       set prop = MyGraph.GetProperties
       set GraphActions = prop.ActionItems
       Types=""
       for i=0 to GraphActions.Count-1
        Types = Types & " " & GraphActions.Item(i).Type
       next
       msgbox "Action items: " & Types
      end sub
      
        • From OnActivateMacro to OnActivateActionItems using charts
          Johan Idh

          As for the listbox you need to get the right ActionItem array, the following should work on any sheet object:

           

          sub ActivationActionItems

          set myobject = ActiveDocument.GetSheetObject("CH01")

          set frame = myobject.GetFrameDef

          set actions = frame.OnActivateActionItems

          for i=0 to actions.Count-1

            msgbox "Action types: " & actions.item(i).Type

          next

          end sub

           

          The ActionItems in chart properties is used when clicking in the chart (only avaliable for gauge charts)

          • Re: From OnActivateMacro to OnActivateActionItems using charts

            also seems to work:

             

            ' QlikView 7.52
            prop.GraphLayout.Frame.OnActivateMacro = "SetActiveObject"    
            
            ' QlikView 10...
            
            prop.GraphLayout.Frame.OnActivateActionItems.Add
            i = prop.GraphLayout.Frame.OnActivateActionItems.Count - 1
            prop.GraphLayout.Frame.OnActivateActionItems.Item(i).Type = 13
            prop.GraphLayout.Frame.OnACtivateActionItems.Item(i).Parameters.Add
            prop.GraphLayout.Frame.OnACtivateActionItems.Item(i).Parameters(0).v = "SetActiveObject"
            obj.SetProperties prop