ImageGadget() question
-
BackupUser
- PureBasic Guru

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

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
In PB Windows, you may get what you're looking for experimenting with the following code:
Can't test it right now, sorry. If you have redraw problems, use:
Hope it helps. Bye,
El_Choni
In PB Windows, you may get what you're looking for experimenting with the following code:
Code: Select all
CreateImage(0, 32, 32)
ImageGadget = ImageGadget(0, 0, 0, 32, 32, UseImage(0))
hImage = LoadImage(1, "newimage.bmp")
SendMessage_(ImageGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage)
Code: Select all
RedrawWindow_(WindowID(), 0, 0, #RDW_ERASE|#RDW_INTERNALPAINT|#RDW_INVALIDATE)
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Doesn't work for me
Here's the code:
The new image is of the same size as the old one, that cannot be the problem.
Timo
A debugged program is one for which you have not yet found the conditions that make it fail.
Doesn't work for me
Here's the code:
Code: Select all
#STM_SETIMAGE = $172
#IMAGE_BITMAP = 0
OpenWindow(0,0,0,500,500,#PB_Window_SystemMenu,"Test")
InitGadget(30)
CreateGadgetList(WindowID())
CreateImage(0, 256, 256)
hImage = LoadImage(1, "newimage.bmp")
ImageGadget = ImageGadget(0, 10, 10, 256, 256, UseImage(0))
SendMessage_(ImageGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage)
RedrawWindow_(WindowID(), 0, 0, #RDW_ERASE|#RDW_INTERNALPAINT|#RDW_INVALIDATE)
Repeat : Until WaitWindowEvent()=#PB_EventCloseWindow
End
Timo
A debugged program is one for which you have not yet found the conditions that make it fail.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
This works here:
Bye,
El_Choni
This works here:
Code: Select all
#STM_SETIMAGE = $172
#IMAGE_BITMAP = 0
If OpenWindow(0,0,0,500,500,#PB_Window_SystemMenu,"Test")
InitGadget(30)
CreateGadgetList(WindowID())
CreateImage(0, 380, 481)
hImage = LoadImage(1, "jatos.bmp")
ImageGadget = ImageGadget(0, 10, 10, 380, 481, UseImage(0))
SendMessage_(ImageGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage)
Repeat
Event = WaitWindowEvent()
If Event = #PB_EventRepaint
RedrawWindow_(WindowID(), 0, 0, #RDW_ERASE|#RDW_INTERNALPAINT|#RDW_INVALIDATE)
EndIf
Until Event=#PB_EventCloseWindow
EndIf
End
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Strange...
This one works for me, too. Even if I delete the RedrawWindow_() call, it still works.
But the other one doesn't, do you see why? Well, I can see no major difference
between the two codes.
Well, anyway, thanks for your Help!
Timo
A debugged program is one for which you have not yet found the conditions that make it fail.
Strange...
This one works for me, too. Even if I delete the RedrawWindow_() call, it still works.
But the other one doesn't, do you see why? Well, I can see no major difference
between the two codes.
Well, anyway, thanks for your Help!
Timo
A debugged program is one for which you have not yet found the conditions that make it fail.
-
BackupUser
- PureBasic Guru

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

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
ANy ideas??? (hopeful look)
Fangles
Hello...I've just tried this to solve a problem had and it almost works expcept that if the actual image data is bigger than the specified size, it fliis up the window (ignoring the size constraints).This works here:
Bye,Code: Select all
#STM_SETIMAGE = $172 #IMAGE_BITMAP = 0 If OpenWindow(0,0,0,500,500,#PB_Window_SystemMenu,"Test") InitGadget(30) CreateGadgetList(WindowID()) CreateImage(0, 380, 481) hImage = LoadImage(1, "jatos.bmp") ImageGadget = ImageGadget(0, 10, 10, 380, 481, UseImage(0)) SendMessage_(ImageGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage) Repeat Event = WaitWindowEvent() If Event = #PB_EventRepaint RedrawWindow_(WindowID(), 0, 0, #RDW_ERASE|#RDW_INTERNALPAINT|#RDW_INVALIDATE) EndIf Until Event=#PB_EventCloseWindow EndIf End
El_Choni
ANy ideas??? (hopeful look)
Fangles
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
Fangles
Thanks El Choni works great on Windows XP, just what I neededIn PB Windows, you may get what you're looking for experimenting with the following code:
Can't test it right now, sorry. If you have redraw problems, use:Code: Select all
CreateImage(0, 32, 32) ImageGadget = ImageGadget(0, 0, 0, 32, 32, UseImage(0)) hImage = LoadImage(1, "newimage.bmp") SendMessage_(ImageGadget, #STM_SETIMAGE, #IMAGE_BITMAP, hImage)
Hope it helps. Bye,Code: Select all
RedrawWindow_(WindowID(), 0, 0, #RDW_ERASE|#RDW_INTERNALPAINT|#RDW_INVALIDATE)
El_Choni
Fangles