Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set object properties in script

hi all,

is it possible to set object's properties in script. for example i want to set object's X and Y position which we define in Caption tab. i want to do that through scripting. is it possible.?? If yes then help me out..

regards

Afzal.

5 Replies
Anonymous
Not applicable
Author

Afzal,
Yes, it is possible. See example with Left=0.


sub Move
set p1 = ActiveDocument.GetSheetObject("TX01")
set fr = p1.GetFrameDef
set pos = fr.Rect
pos.Left = 0
p1.SetFrame fr,true, ""
end sub

In the same macro, you can define Top, Height, Width.

Not applicable
Author

Hi Afzal,

As far as I know you can't set object positions straight from the script. However, you could run a macro when opening your QVW, which reads values from variables defined in your script and uses those to position objects.

Attached is a simple QVW which defines two variables x_pos and y_pos in the script, and a macro position_table which positions the tablebox to the location defined by x_pos and y_pos.

With regards,

Martijn ter Schegget

Not applicable
Author

PS: to find out more about macro syntax, take a look at the 'Apiguide.qvw' in the Documentation subdirectory of your QlikView program directory.

Martijn

Not applicable
Author

This is awesome! I am a designer not a programmer, and I really liked how well this works. Is there any way you could give me an example of how you could apply this to multiple objects? Not all objects on the sheet, just a certain set of objects.

Thanks,
Kris

Not applicable
Author

thanks for this example you really saved my design!

Thanks

Mireille