Page 1 of 1

PictureBox image not clearing

Posted: Friday 3rd November 2017 12:10am
by Quincunxian
Greetings fellow Gambastions
I have a Picturebox component on a form that I wish to clear.
I've tried the following in my Form clean up routine...
  If Not IsNull(Pic_Image.Picture) Then
    Pic_Image.Picture.Clear
    Pic_Image.Picture.Flush
  Endif
The Null test is required when the form first instantiates and does an initial clean up as there is no picture (Null)
Both the clear and flush lines are called when the PictureBox has a valid image and the form clean up routines are called.

Can someone else try this please as I want to confirm that it may be a bug, not just a "Me and my machine" problem please ?
I'm on KUbuntu with Gambas 3.10.90

Re: PictureBox image not clearing

Posted: Friday 3rd November 2017 12:10pm
by cogier
Hi Quin,

I think the line you are looking for is
PictureBox1.Picture = Null
I created this, hope it helps.
test.tar
(42.5 KiB) Downloaded 500 times

Re: PictureBox image not clearing

Posted: Saturday 4th November 2017 10:16am
by jornmo
I think he is asking us to test his code, and report weather its working or not cogier. I am unable to try it for the moment, as Gambas will not start due to some recent QT upgrade that seems to break it.

Re: PictureBox image not clearing

Posted: Saturday 4th November 2017 11:51am
by cogier
Even though the help files say that the '.Picture.Clear' clears the picture. I can not get the picture to clear using Quin's code.

Re: PictureBox image not clearing

Posted: Saturday 4th November 2017 2:48pm
by jornmo
So, it's a bug, or even worse, a poorly documented feature...

Re: PictureBox image not clearing

Posted: Sunday 5th November 2017 1:35am
by Quincunxian
Thanks Jornmo & Cogier,
I did try setting to Null too and that did not work either so I guess that it's a bug.
I'll post of the Gambas forum and see what happens and let you know.

Re: PictureBox image not clearing

Posted: Sunday 5th November 2017 1:14pm
by cogier
I have loaded Kubuntu 17.10, added the Gambas ppa for Gambas 3.10.0 (stable) then run my program and it works just fine. Have a look at the video I created here http://www.cogier.com/test/.