Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

VB script to set BG for text box

Hi

I could not found how to set background file for text box from VB script. I did find how to change option:

' prop.Layout.BkgMode = 2

Where prop is text box properties.

But how to set file (layout.setBG("C:\image.jpg) style is open.

It would be nice to have!

Thanks beforehand if someone could assist with this!



7 Replies
Not applicable
Author

Hi,

It's exatly what I want too.

Nobody know ?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The ApiGuide,qvw provides an example for almost every member, Select the member (BkgMode) and then go to the "Automation Examples" sheet. On that sheet you may have to select a Class (ITextObjectLayout) and then you will see an example.

Let me know if that doesn't answer your question.

-Rob

http://masterssummit.com

http://robwunderlich.com

Not applicable
Author

Hi,

Thanks for the quick reponse.

I have already try to find an answer on the API Guide.


I would like to do something like this :

set button = ActiveDocument.GetSheetObject("TX33")

set prop = button.GetProperties

prop.Layout.BkgMode = 2 'Image BKG

And after that, add something to specify which image used like :

prop.Layout.BkgImageSetting= "C:\Users\Desktop\Test.png"

But i don't know what is the right synthax...

Thibault.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not sure, but I think it may not be possible to select the background image using the API. The reason is that the image name is not a property of the object. Rather, the image stream is copied into the QVW as an encoded stream member (ImageBlog) when you select it from the UI. So you would need to figure out how to create one of those ImageBlobs, which I'm not sure is possible from the API.

-Rob

http://masterssummit.com

http://robwunderlich.com

Not applicable
Author

Thanks for your answer. I explains you why I want to do.

The simple solution is to modify the text and the representation of the text box like this :

set button = ActiveDocument.GetSheetObject("TX33")

set prop = button.GetProperties

prop.Layout.ImageRepresentation.Presentation=1

prop.Layout.text.v="C:\Test.png"

But my problem is that the picture don't refresh itself.

If I modify the picture and save it with the same name (and not close Qlikview and re-open it), it doesn't update.

I try to find a solution to refresh it (without re-open QlikView) !

I don't know if I'm understandable....

Can U help me ?

Thanks beforehand

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Try adding:

ActiveDocument.GetApplication.Refresh

-Rob

Not applicable
Author

I try but still desn't work.

I think the only way is to reload the script.

Thanks for your help !