Page 1 of 1

SetGadgetAttribute(#Gadget, #PB_Image_Border, 1)

Posted: Mon May 31, 2010 9:58 pm
by zxtunes.com
Rather strange to have an attribute which then can not be changed.
But it may be useful, this is my small example, #PB_Image_Border I could use as a cursor.

Example:
Image

Re: SetGadgetAttribute(#Gadget, #PB_Image_Border, 1)

Posted: Mon May 31, 2010 10:19 pm
by Trond
You could also use a frame3d gadget.

Re: SetGadgetAttribute(#Gadget, #PB_Image_Border, 1)

Posted: Tue Jun 01, 2010 1:04 am
by PureLust
zxtunes.com wrote:Rather strange to have an attribute which then can not be changed.
As long as it's not implemented in PB, you could do it like this:

Code: Select all

For n = 0 To 4
	CreateImage(n,50,50)
	If StartDrawing(ImageOutput(n))
		Box(0,0,50,50,$aaaaaa)
		DrawText(20,20,Str(n),$FF,$aaaaaa)
		StopDrawing()
	EndIf
Next n

OpenWindow(0,0,0,310,70,"ImageBorder as Selection-Cursor", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
For n = 0 To 4
	ImageGadget(n, 10 + n*60,10,50,50,ImageID(n))
Next n

Repeat
	Event = WaitWindowEvent()
	If Event = #PB_Event_Gadget
		Gadget = EventGadget()
		If EventType() = #PB_EventType_LeftClick
			For n = 0 To 4
				
				If n = Gadget
					
					ImageGadget(n, 10 + n*60,10,50,50,ImageID(n),#PB_Image_Border)
					SetGadgetData(n,#PB_Button_PressedImage)
					
				ElseIf GetGadgetData(n) = #PB_Button_PressedImage
					
					ImageGadget(n, 10 + n*60,10,50,50,ImageID(n))
					SetGadgetData(n,0)
					
				EndIf
				
			Next n
		EndIf
	EndIf
			
Until Event = #PB_Event_CloseWindow