Page 1 of 1

[Implemented] toggleable buttonimagegadget

Posted: Tue Jun 22, 2004 7:48 pm
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...)

Posted: Tue Jun 22, 2004 8:34 pm
by GPI

Posted: Tue Jun 22, 2004 9:47 pm
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

Posted: Wed Jun 23, 2004 8:47 am
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 :-)