Page 1 of 1

Image in background of gadgets - is there a workaround?

Posted: Sat Dec 03, 2011 6:59 pm
by jesperbrannmark
Hi.
I use a background sometimes behind gadgets, it makes it look nicer.
But on mac there is no way of clicking on the gadgets. You can only use TAB to get to the next one.
Try this sample and then try to click on the second stringgadget - nothing happens.
On PC the DisableGadget(0,1) line is needed, otherwise it will not work there either.
If there a workaround on the Mac to glue the image to the background without interfering with the functionality of the gadgets?

Code: Select all

UseJPEGImageDecoder()
OpenWindow(0, 220, 0, 480,220, "Image", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )
LoadImage(0,"spine.jpg")
ImageGadget(0, 0, 0, ImageWidth(0),250, ImageID(0))
DisableGadget(0,1)
StringGadget(1, 250, 85, 180, 18, "")
StringGadget(2, 250, 109, 180, 18, "")
SetActiveGadget(1)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Image in background of gadgets - is there a workaround?

Posted: Sat Dec 03, 2011 8:33 pm
by IdeasVacuum
Well, something that might work is to dispense with the image gadget and just draw the image on the window.........

SOLVED Image in background of gadgets - is there a workaroun

Posted: Sat Dec 03, 2011 8:38 pm
by jesperbrannmark
Yep. True. thanks

Code: Select all

UseJPEGImageDecoder()
OpenWindow(0, 220, 0, 480,220, "Image", #PB_Window_ScreenCentered | #PB_Window_SystemMenu )
LoadImage(0,"spine.jpg")
StartDrawing(WindowOutput(0))
DrawImage(ImageID(0),0,0)
StopDrawing()
StringGadget(1, 250, 85, 180, 18, "")
StringGadget(2, 250, 109, 180, 18, "")
SetActiveGadget(1)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Image in background of gadgets - is there a workaround?

Posted: Sun Dec 04, 2011 7:26 pm
by Polo
IIRC you should watch out for windows repaint event to avoid your image to disappear :)