Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dynamically pick up objects of a document

Hi All,

How can I pick up the list of all objects of a particular type and set some of its properties?

ex) iterate through all listboxes and set its color,font etc.

I would like to create either a macro or an extension to do it.

Thanks,

Anju

6 Replies
Gysbert_Wassenaar

You can find a bit of code to iterate through sheet objects and do something with them based on the type of object: http://community.qlik.com/thread/65818.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Wassenaar,

I tried this:

but when I click the button, there is some error.. as it stops at next....

sub n

objs = ActiveDocument.ActiveSheet.GetActiveSheetObjects


for i = lBound(objs) to uBound(objs)         ' loop through all active objects

        set aObj = objs(i)                       ' grab one object at a time

        prop = aObj.GetProperties                ' store the original properties

        prop.Layout.BkgColor.Luminosity = 75     ' set gradient to black

        prop.Layout.BkgColor.Mode = 1            ' set 1-color gradient

        prop.Layout.BkgColor.FillDirection = 0   ' set horizontal orientation

        prop.Layout.BkgColor.FillPattern = 0     ' set light to dark pattern

        aObj.SetProperties prop                  ' set the modified properties to the object

    next

end sub

Gysbert_Wassenaar

As you can see in the code I linked to, different objects have different property api's. The code lists three different code paths to get the helptext of an object. Your code will very likely also need to consider the object type to set the properties correctly. See the QlikView Core COM API Guide - Version 11 for information.


talk is cheap, supply exceeds demand
Not applicable
Author

I was not able to find how to set the caption background color.

What does set palette do?

Not applicable
Author

Hi,

I tried this:

mbp.GraphLayout.Frame.ActiveBgColor.PrimaryCol.Col=RGB(1,1,1)

mbp.GraphLayout.Frame.Color.PrimaryCol.Col=RGB(1,1,1)

I got the hierarchy from a qvt file.

Though the macro does not give any error during button click, it does not have any effect on the chart.

Am I missing something?

Not applicable
Author

Is it possible to replicate the same via an extension object using JavaScript?