ButtonImageGadget() + #PB_Button_Toggle

Share your advanced PureBasic knowledge/code with the community.
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

ButtonImageGadget() + #PB_Button_Toggle

Post by Dräc »

Code updated For 5.20+

If you want a ButtonImageGadget() with the 'Toogle' property, do like this:

Code: Select all

If OpenWindow(0,0,0,240,200,"A toggle ButtonImageGadget",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  CreateImage(0, 50, 50)
  
  ButtonGadget(0, 10, 10, 50, 50, "", #PB_Button_Toggle| #BS_BITMAP)
  SendMessage_(GadgetID(0), #BM_SETIMAGE, #IMAGE_BITMAP, ImageID(0))
  
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf