.GraphicURL no longer works in 6.1.0.3

traffic_light.ods

Attached is an example I found somewhere that changes the image when you select a color from a list. It worked before with 6.0.5.2, but fails with error in 6.1.0.3. I found some info saying that there has been a change but they all show examples using an image from file and I can’t get it to work with images from another sheet.

The error at line 31 “ResultPicture.GraphicURL = srcImage.GraphicURL”:
BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.IllegalArgumentException
Message: .

What changes do I need to make this work again?

I would link to source of example if I knew where I got it, google wasn’t much help.

.GraphicURL was removed in 6.1

Replace line 31

ResultPicture.GraphicURL = srcImage.GraphicURL

with

ResultPicture.Graphic = srcImage.Graphic

This works! Thanks.
Any idea how far back this works?

This works all way back to OOo 3.3.0 (inclusive), but not with OOo 3.2.0 (where original doesn’t work either).

Thanks for the info!

Why there is still GraphicURL in the source?

https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1drawing_1_1GraphicObjectShape.html#a6312a2da62e2c67c90d5576502117906