ButtonImageGadget disappears

Just starting out? Need help? Post your questions and find answers here.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: ButtonImageGadget disappears

Post by Fangbeast »

PB5.11 Don't know if this is related or not but I have a ToggleImageGadgetButton in a container and it vanishes when the program starts and re-appears when you hover the mouse over it.

Previous versions of PB were okay.

Standard ImageButtons seem to be okay.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Lord
Addict
Addict
Posts: 907
Joined: Tue May 26, 2009 2:11 pm

Re: ButtonImageGadget disappears

Post by Lord »

Hi Fangles!
Fangbeast wrote:...
Standard ImageButtons seem to be okay.
Don't think so. Try this:

Code: Select all

EnableExplicit

Enumeration
  #MainWindow
EndEnumeration

Enumeration
  #Toolbar
EndEnumeration

Enumeration
  #myImgButton
  #myNrmButton
EndEnumeration

Define Quit.i, Event.i

OpenWindow(#MainWindow, 10, 10, 300, 300, "Test")

CreateToolBar(#Toolbar, WindowID(#MainWindow))

ButtonImageGadget(#myImgButton, WindowWidth(#MainWindow)-30, 1, 24, 24, 0);, #PB_Button_Toggle)
SetParent_(GadgetID(#myImgButton), ToolBarID(#Toolbar))

ButtonGadget(#myNrmButton, WindowWidth(#MainWindow)-60, 1, 24, 24, "", #PB_Button_Toggle)
SetParent_(GadgetID(#myNrmButton), ToolBarID(#Toolbar))


Quit=0

Repeat
Event=WaitWindowEvent()
Select Event
    Case #PB_Event_CloseWindow
      Quit=#True
  EndSelect
Until Quit

End
I just commented out the flag on ButtonImageGadget
in my first example. Same behaviour.
Image
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: ButtonImageGadget disappears

Post by Fangbeast »

ImageButtonGadget with toggle flag, on a container, button vanishes on startup.
ImageButtonGadget with no flag, on a container, button is okay.

PB 5.11, Windows 8 PRO.

And I can reliably reproduce this. It's always the button with the toggle flag.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: ButtonImageGadget disappears

Post by RASHAD »

See if the next works fine with you Fangles

Code: Select all

;EnableExplicit

Enumeration
  #MainWindow
EndEnumeration

Enumeration
  #Toolbar
  #TBB1
  #TBB2
  #TBB3
EndEnumeration

Enumeration
  #myImgButton = 100
  #myNrmButton = 101
EndEnumeration


  CreateImage(0, 24, 24)
  StartDrawing(ImageOutput(0))
  Box(0, 0, 24, 24, $F0F0F0)
  LineXY(0,0, 23,23, $0000FF)
  LineXY(0,23, 23,0, $0000FF)
  StopDrawing()
  
  CreateImage(1, 24, 24)
  StartDrawing(ImageOutput(1))
  Box(0, 0, 24, 24, $F0F0F0)
  DrawingMode(#PB_2DDrawing_Outlined)
  Circle(12, 12, 4, $0000FF)
  StopDrawing()

Define Quit.i, Event.i

OpenWindow(#MainWindow, 10, 10, 300, 300, "Test")

CreateToolBar(#Toolbar, WindowID(#MainWindow))
ToolBarStandardButton(#TBB1, #PB_ToolBarIcon_New)
ToolBarStandardButton(#TBB2, #PB_ToolBarIcon_Open)
ToolBarStandardButton(#TBB3, #PB_ToolBarIcon_Save)

ButtonImageGadget(#myImgButton, WindowWidth(#MainWindow)-30, 1, 24, 24, ImageID(1), #PB_Button_Toggle)
SetParent_(GadgetID(#myImgButton), ToolBarID(#Toolbar))

ButtonGadget(#myNrmButton, WindowWidth(#MainWindow)-60, 1, 24, 24, "", #PB_Button_Toggle)
SetParent_(GadgetID(#myNrmButton), ToolBarID(#Toolbar))


Quit=0
Image = 1

Repeat
Event=WaitWindowEvent()
Select Event
    Case #PB_Event_CloseWindow
      Quit=#True
      
    Case #PB_Event_Gadget
        Select EventGadget()
          Case #myImgButton
            Image ! 1
            SetGadgetAttribute(#myImgButton,#PB_Button_Image,ImageID(Image))
        EndSelect
      
    Case #WM_KEYDOWN
        If EventwParam() = 9
           InvalidateRect_(GadgetID(#myImgButton),0,1)
        EndIf
  EndSelect
Until Quit

End 

Egypt my love
User avatar
Lord
Addict
Addict
Posts: 907
Joined: Tue May 26, 2009 2:11 pm

Re: ButtonImageGadget disappears

Post by Lord »

Hi Rashad!
RASHAD wrote:See if the next works fine with you Fangles
...
I'm not Rashad, but your code still does'nt work for me.
PB 5.11 (and 5.10) x86, Win7 Ultimate, SP1 x64
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: ButtonImageGadget disappears

Post by RASHAD »

Hi Lord :P
Yes you said that before
That is why I am talking to Fangles
Because it works here with PB 5.11 Win XP SP2,Win 7 x64 & Win 8 x64
So let us here from Fangles maybe we can isolate the problem
Egypt my love
Post Reply