Posted: Tue Sep 10, 2002 9:32 pm
Restored from previous forum. Originally posted by PB.
Don't know if this is a bug or not... so please test this for me.
You'll need 2 x BMP images called 0.bmp and 1.bmp for the test.
Run the code, make sure the window has the focus, then press any
key a few times. No images are shown. Then uncomment the commented
line and it works... why? Shouldn't the toggling action work without
having to load an "initial" image first?
PB - Registered PureBasic Coder
Don't know if this is a bug or not... so please test this for me.
You'll need 2 x BMP images called 0.bmp and 1.bmp for the test.
Run the code, make sure the window has the focus, then press any
key a few times. No images are shown. Then uncomment the commented
line and it works... why? Shouldn't the toggling action work without
having to load an "initial" image first?
Code: Select all
If OpenWindow(0,100,150,450,200,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
;pic=LoadImage(1,"0.bmp")
ig=ImageGadget(1,0,0,0,0,pic)
Repeat
ev=WaitWindowEvent()
If ev=#WM_KEYDOWN
a=1-a : pic=LoadImage(1,Str(a)+".bmp")
SendMessage_(ig,#STM_SETIMAGE,#IMAGE_BITMAP,pic)
EndIf
Until ev=#PB_EventCloseWindow
EndIf
PB - Registered PureBasic Coder