PictureBox image not clearing

Post your Gambas programming questions here.
Post Reply
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

PictureBox image not clearing

Post 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
Cheers - Quin.
I code therefore I am
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post 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 489 times
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: PictureBox image not clearing

Post 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.
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post 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.
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: PictureBox image not clearing

Post by jornmo »

So, it's a bug, or even worse, a poorly documented feature...
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: PictureBox image not clearing

Post 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.
Cheers - Quin.
I code therefore I am
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post 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/.
Post Reply