PictureBox image not clearing

Post Reply
User avatar
Quincunxian
Posts: 6
Joined: Sunday 25th June 2017 12:14am

PictureBox image not clearing

Post by Quincunxian » Friday 03rd November 2017 12:10am

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: 115
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post by cogier » Friday 03rd November 2017 12:10pm

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 4 times

User avatar
jornmo
Site Admin
Posts: 127
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: PictureBox image not clearing

Post by jornmo » Saturday 04th November 2017 10:16am

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: 115
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post by cogier » Saturday 04th November 2017 11:51am

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: 127
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: PictureBox image not clearing

Post by jornmo » Saturday 04th November 2017 2:48pm

So, it's a bug, or even worse, a poorly documented feature...

User avatar
Quincunxian
Posts: 6
Joined: Sunday 25th June 2017 12:14am

Re: PictureBox image not clearing

Post by Quincunxian » Sunday 05th November 2017 1:35am

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: 115
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: PictureBox image not clearing

Post by cogier » Sunday 05th November 2017 1:14pm

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

Who is online

Users browsing this forum: No registered users and 2 guests