Page 1 of 1
Posted: Tue Oct 29, 2002 12:49 am
by BackupUser
Restored from previous forum. Originally posted by Keith.
Hi,
This Code wont load the image into the image gadget dose anyone have any idea why?
Code: Select all
If OpenWindow(1,0,0,250,150,#PB_Window_ScreenCentered | #PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
LoadImage(0,"image.bmp")
ImageGadget(1,0,0,100,100,UseImage(1))
Repeat
Select WindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Thanks
Keith
Posted: Tue Oct 29, 2002 1:29 am
by BackupUser
Restored from previous forum. Originally posted by WolfgangS.
HI!
Write ImageGadget(1,0,0,100,100,ImageID())
instead of ImageGadget(1,0,0,100,100,UseImage(1))
UseImage(1) just try to activate an Image with the ID 1 (which even isn't loaded

ImageID() gives you the handle (in PureBasic the "ID") from the Image you need.
Hint: Use WaitWinodwEvent() instead of WindowEvent()
I would write this:
Code: Select all
#ID_MWidnow = 0
#ID_Image1 =10
#ID_IGadget1 =20
hnd_MWindow.l ; handle of the MotherWindow
WEvent.l ; Event's of the MotherWindow
hnd_MWidnow=OpenWindow(#ID_MWidnow,0,0,250,150,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"Test")
If LoadImage(#ID_Image1,"e:\font2.bmp")=0
beep_(100,1000):End
EndIf
If CreateGadgetList(WindowID())=0
beep_(100,1000):End
Else
ImageGadget(#ID_IGadget1,0,0,100,100,ImageID())
EndIf
Repeat
WEvent=WaitWindowEvent()
Until WEvent=#PB_Event_CloseWindow
MFG
:)WolfgangS
Posted: Tue Oct 29, 2002 3:26 am
by BackupUser
Restored from previous forum. Originally posted by Franco.
Keith, there is an error in your code,because you do:
LoadImage(0,"image.bmp")
ImageGadget(1,0,0,100,100,UseImage(1))
You load an image with the number 0 but USE an IMAGE with number 1.
There is no image with number 1. Only number 0.
Should be:
ImageGadget(1,0,0,100,100,UseImage(0))
Have a nice day...
Franco
Posted: Tue Oct 29, 2002 2:15 pm
by BackupUser
Restored from previous forum. Originally posted by Keith.
Thanks