[Gambas-user] Problem clearing picture in a PictureBox

2012-11-30 Thread Willy Raets
Hi,

I've this form with a Panel and in there some TextBoxes, PictureBoxes
and some Buttons.
Button opens a Dialog to browse for PNG files and when selected show use
the Dialog.Path to load the PNG into PictureBox (using PicBox.Picture =
Picture.Load(Dialog.Path))

At a certain moment I want to clear the form and have this little
rountine:

Public Sub PanelClear()

   TextBox1.Clear
   TextBox2.Clear
   PictureBox1.Picture.Clear
   PictureBox2.Picture.Clear
   Me.Refresh

End

TextBoxes clear properly, but PictureBoxes don't.
The loaded PNG stays visible in the PictureBox.

If one of the PictureBoxes has no loaded picture in there on clearing an
error is generated because of it being Null.

1. How do I get the PictureBoxes cleared of the shown picture?
Am I using Clear wrongly? Also tried PictureBox1.Picture.Flush with no
success.

2. How test for a empty PictureBox?
I tried testing with IsNull(PictureBox.Picture), but that doesn't seem
to do the job.

Any suggestions that might get me on the road again?

Running Gambas 3.3.4 on Linux Mint 13 - Mate desktop
Using gb.qt4 in the project.

Willy




--
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Problem clearing picture in a PictureBox

2012-11-30 Thread Benoît Minisini
Le 30/11/2012 16:04, Willy Raets a écrit :
 Hi,

 I've this form with a Panel and in there some TextBoxes, PictureBoxes
 and some Buttons.
 Button opens a Dialog to browse for PNG files and when selected show use
 the Dialog.Path to load the PNG into PictureBox (using PicBox.Picture =
 Picture.Load(Dialog.Path))

 At a certain moment I want to clear the form and have this little
 rountine:

 Public Sub PanelClear()

 TextBox1.Clear
 TextBox2.Clear
 PictureBox1.Picture.Clear
 PictureBox2.Picture.Clear
 Me.Refresh

 End

 TextBoxes clear properly, but PictureBoxes don't.
 The loaded PNG stays visible in the PictureBox.

 If one of the PictureBoxes has no loaded picture in there on clearing an
 error is generated because of it being Null.

 1. How do I get the PictureBoxes cleared of the shown picture?
 Am I using Clear wrongly? Also tried PictureBox1.Picture.Flush with no
 success.

 2. How test for a empty PictureBox?
 I tried testing with IsNull(PictureBox.Picture), but that doesn't seem
 to do the job.

 Any suggestions that might get me on the road again?

 Running Gambas 3.3.4 on Linux Mint 13 - Mate desktop
 Using gb.qt4 in the project.

 Willy


PictureBox1.Picture = Null

PictureBox1.Picture.Clear only clears the contents of the picture 
returned by the property, which is somewhat a copy of the internal 
picture of the PictureBox which stays unchanged.

Regards,

-- 
Benoît Minisini

--
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Problem clearing picture in a PictureBox

2012-11-30 Thread Willy Raets
On Fri, 2012-11-30 at 16:06 +0100, Benoît Minisini wrote:
 Le 30/11/2012 16:04, Willy Raets a écrit :
  Hi,
 
  I've this form with a Panel and in there some TextBoxes, PictureBoxes
  and some Buttons.
  Button opens a Dialog to browse for PNG files and when selected show use
  the Dialog.Path to load the PNG into PictureBox (using PicBox.Picture =
  Picture.Load(Dialog.Path))
 
  At a certain moment I want to clear the form and have this little
  rountine:
 
  Public Sub PanelClear()
 
  TextBox1.Clear
  TextBox2.Clear
  PictureBox1.Picture.Clear
  PictureBox2.Picture.Clear
  Me.Refresh
 
  End
 
  TextBoxes clear properly, but PictureBoxes don't.
  The loaded PNG stays visible in the PictureBox.
 
  If one of the PictureBoxes has no loaded picture in there on clearing an
  error is generated because of it being Null.
 
  1. How do I get the PictureBoxes cleared of the shown picture?
  Am I using Clear wrongly? Also tried PictureBox1.Picture.Flush with no
  success.
 
  2. How test for a empty PictureBox?
  I tried testing with IsNull(PictureBox.Picture), but that doesn't seem
  to do the job.
 
  Any suggestions that might get me on the road again?
 
  Running Gambas 3.3.4 on Linux Mint 13 - Mate desktop
  Using gb.qt4 in the project.
 
  Willy
 
 
 PictureBox1.Picture = Null
 
 PictureBox1.Picture.Clear only clears the contents of the picture 
 returned by the property, which is somewhat a copy of the internal 
 picture of the PictureBox which stays unchanged.

Simple and effective :)
Works as a charm.

Thank you,

Willy



--
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user