Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

5abi0001
New Contributor III

Set actions via Macro

Hey! Via a macro i create textboxes. Now what i want to do is, to set also certain actions for this created textboxes like on click on the textbox it should set a value for a variable or run a macro. Is it possible to give the textbox such instructions?

5 Replies

Re: Set actions via Macro

Macro Action:


Sub Test 

 

set MyText = ActiveDocument.ActiveSheet.CreateTextObject

set prop = MyText.GetProperties 

set TextActions = prop.Layout.ActionItems 

TextActions.Add 

TextActions.Item(0).Type=13  

 

set ActionParam=TextActions.Item(0).Parameters

ActionParam.Add 

ActionParam.Item(0).v="Test" 

MyText.SetProperties prop 

 

End Sub 

Variable Action:

Sub Test

Set MyText = ActiveDocument.ActiveSheet.CreateTextObject

set prop = MyText.GetProperties

set TextActions = prop.Layout.ActionItems

TextActions.Add

TextActions.Item(0).Type=31

set ActionParam=TextActions.Item(0).Parameters

ActionParam.Add

ActionParam.Item(0).v="Test"

ActionParam.Add

ActionParam.Item(1).v="0"

MyText.SetProperties prop

End Sub

5abi0001
New Contributor III

Re: Set actions via Macro

Hey! Thank you this is exact this, what im looking for. How i can add this two actions within a sub? tamilarasu

Re: Set actions via Macro

Hi Prince,

Here is the code.

Sub Test

set MyText = ActiveDocument.ActiveSheet.CreateTextObject
set prop = MyText.GetProperties   
set TextActions = prop.Layout.ActionItems   

TextActions.Add   
TextActions.Item(0).Type=13

set ActionParam=TextActions.Item(0).Parameters
ActionParam.Add   
ActionParam.Item(0).v="Macro_Test"

''''MyText.SetProperties prop  

TextActions.Add 
TextActions.Item(1).Type=31

set ActionParam= TextActions.Item(1).Parameters 
ActionParam.Add  
ActionParam.Item(0).v= "Variable_Test" 
ActionParam.Add   
ActionParam.Item(1).v="0"

MyText.SetProperties prop

End Sub

5abi0001
New Contributor III

Re: Set actions via Macro

Thank you! U are the best!

Re: Set actions via Macro

Have a nice day and happy weekend, Prince.

Community Browser