a normal buttongadget can be made toggleable (3x word value in scrabble) with the appropriate flag, a buttonimagegadget cannot...
(it's a good thing i don't get points for feature requests...)
[Implemented] toggleable buttonimagegadget
[Implemented] toggleable buttonimagegadget
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Using Win32API, this seems to work too.
Code: Select all
;- Change path to your image path
LoadImage(0, "C:\Program Files\PureBasic\Examples\Sources\Data\PureBasic.bmp")
If OpenWindow(0, 20, 20, 400, 150, #PB_Window_SystemMenu | #PB_Window_TitleBar , "Test")
If CreateGadgetList(WindowID())
ButtonImageGadget(0, 10, 10, 200, 50, UseImage(0))
style = GetWindowLong_(GadgetID(0), #GWL_STYLE)
toggleStyle = style |$1003
SetWindowLong_(GadgetID(0), #GWL_STYLE, toggleStyle)
ButtonImageGadget(1, 10, 80, 200, 50, UseImage(0))
TextGadget(2, 225, 30, 150, 20, "Toggled ButtonImageGadget")
TextGadget(3, 225, 100, 150, 20, "Normal ButtonImageGadget")
EndIf
EndIf
quit = #False
Repeat
event = WaitWindowEvent()
Select event
Case #PB_EventCloseWindow
quit = #True
EndSelect
Until quit
End
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
yeah, rings pointed me out to setwindowlog_() as well, so i got it working, but i think it would not be entirely illogical to have this function in pb as standard 

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )