Found an issue in SpiderBasic ? Please report it here !
hoerbie
 
Posts: 16
Joined: Sun Mar 17, 2019 5:51 pm

2.21 ImageGadget SetGadgetState(#Gadget,0) doesn't delete im

by hoerbie Tue Sep 03, 2019 5:52 pm

In the docs it says for ImageGadget:
SetGadgetState(): Change the current Image of the gadget. ... If the ImageID is 0, then the image is removed from the gadget.


Using this modified help example it doesn't delete the image.

Code: Select all
Procedure imagechange()
  If EventGadget() = 1
    SetGadgetState(0,0)
    Debug "Delete"
  Else
    SetGadgetState(0,ImageID(0))
    Debug "Set"
  EndIf
EndProcedure

If OpenWindow(0, 0, 0, 200, 105, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CreateImage(0, 16, 16, 32, #PB_Image_Transparent)
  If StartDrawing(ImageOutput(0))
    Circle(8, 8, 7, RGB(255, 0, 0))
    StopDrawing()
  EndIf
 
  ImageGadget(0,  10, 10, 100, 83, ImageID(0))                    ; imagegadget standard
  ButtonGadget(1, 130, 10, 50, 20,"Delete")
  ButtonGadget(2, 130, 50, 50, 20,"Set")
 
  BindGadgetEvent(1, @imagechange())
  BindGadgetEvent(2, @imagechange()) 
EndIf


I need to paint empty real images to blank ImageGadgets actually.
Peter53
 
Posts: 11
Joined: Thu Mar 28, 2019 2:58 pm

Re: 2.21 ImageGadget SetGadgetState(#Gadget,0) doesn't delet

by Peter53 Wed Sep 04, 2019 10:21 am

use
Code: Select all
SetGadgetState(0,-1)
Fred
Site Admin
 
Posts: 1162
Joined: Mon Feb 24, 2014 10:51 am

Re: 2.21 ImageGadget SetGadgetState(#Gadget,0) doesn't delet

by Fred Wed Sep 04, 2019 1:12 pm

It should work with 0 though, I will take a look
hoerbie
 
Posts: 16
Joined: Sun Mar 17, 2019 5:51 pm

Re: 2.21 ImageGadget SetGadgetState(#Gadget,0) doesn't delet

by hoerbie Wed Sep 04, 2019 2:28 pm

Sorry, I forgot,
Code: Select all
SetGadgetState(0,-1)

deletes the image, that's right.

But after the image disappears, the event handling seems to stop, because my debug message isn't shown, so using -1 is no solution (Firefox on MacOS).
User avatar
Niffo
 
Posts: 50
Joined: Sat Jun 16, 2018 10:30 pm

Re: 2.21 ImageGadget SetGadgetState(#Gadget,0) doesn't delet

by Niffo Fri Sep 13, 2019 4:03 pm

Bug confirmed (seems to be only with transparency images)
Return to Bugs Reports

Who is online

Users browsing this forum: No registered users and 3 guests