[Implemented] toggleable buttonimagegadget

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

[Implemented] toggleable buttonimagegadget

Post by blueznl »

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...)
( 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... )
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

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... )
Post Reply