WebImageView > Remove Picture

Probably I am blind but how do I remove a picture from a WebImageView once it is set?

Neither WebImageView.Picture = NIL nor WebImageView.URL = "" work.

Looks like a nasty bug worth a report.

You can assign a blank dummy to the picture or try this in sequence:

webimage1.url = “”
webimage1.picture = nil

I just tested and it works.

You mean a 1x1px transparent picture? Thought about that too. But would prefer a ‘proper’ way.

I modified my post. Refresh your page. The sequence I wrote works for clearing the picture.

Here is a JavaScript workaround. Nevertheless, I still think this is a bad bug that should be corrected. Changing the URL at least should change the picture. That’s all the JavaScript does.

Constant Substitute :

var str = document.getElementById("demo").innerHTML; var res = str.replace("Find", "Substitute"); document.getElementById("demo").innerHTML = res;

Erases the picture :

dim js as string = substitute js = replaceall(substitute,"demo",ImageView1.ControlID) js = replace(js,"Find",ImageView1.URL) js = replace(js,"Substitute","") self.ExecuteJavaScript(js)

To put another URL, enter it instead of “” in the 4th line :

js = replace(js,"Substitute","mypictureurl")

When the control is not behaving as expected, you must use a workaround.

There is yet another one : turn the control invisible.

The easiest way to do it:

webimage1.url = “”
webimage1.picture = nil

in sequence.

[quote=220636:@Julio Debroy]The easiest way to do it:

webimage1.url = “”
webimage1.picture = nil

in sequence.[/quote]

Which simply does not work. Neither does changing picture.

This is a bad, bad, undoubtable bug. It should be fixed.

It works perfectly for me, as well as changing picture. Alex, does it work for you? Of course substitute webimage1 for the name of your component

webimage1.url = “”
webimage1.picture = nil

Works here too. (Xojo 2015 Release 2.4)

It does work. I was niling the picture before the URL.

[quote=220636:@Julio Debroy]The easiest way to do it:

webimage1.url = “”
webimage1.picture = nil

in sequence.[/quote]

That worked perfectly. I tried either but not in conjunction :slight_smile: