Restored from previous forum. Originally posted by Voldemort.
Hello, I'm including several icons (with IncludeBinary) that I need to display on my window. In the past I would save them to disk and load them into an Image object, but now I want to use the CatchImage command with them. How? I can't seem to get them to work. I am using one single image object that needs to change its image to different icons depending on the user's action, so I'm guessing I need to use SetGadgetState with CatchImage somehow...? Thx.
Displaying icons on window?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Berikco.
Regards,
Berikco
http://www.benny.zeb.be/purebasic.htm
Code: Select all
; PureBasic Visual Designer v3.61
;- Window Constants
;
#Window_0 = 0
;- Gadget Constants
;
#Gadget_0 = 0
Global Icon1, Icon2
Icon1 = CatchImage(1, ?Icon1)
Icon2 = CatchImage(2, ?Icon2)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 328, 225, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
If CreateGadgetList(WindowID())
ImageGadget(#Gadget_0, 50, 50, 215, 125, Icon1)
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
If Event = #WM_LBUTTONDOWN
SetGadgetState(#Gadget_0, Icon2)
ElseIf event = #WM_RBUTTONDOWN
SetGadgetState(#Gadget_0, Icon1)
EndIf
Until Event = #PB_EventCloseWindow
End
DataSection
Icon1:
IncludeBinary "test1.ico"
Icon2:
IncludeBinary "test2.ico"
EndDataSection
Berikco
http://www.benny.zeb.be/purebasic.htm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm