SetGadgetAttribute(#Gadget, #PB_Image_Border, 1)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
zxtunes.com
Enthusiast
Enthusiast
Posts: 375
Joined: Wed Apr 23, 2008 7:51 am
Location: Saint-Petersburg, Russia
Contact:

SetGadgetAttribute(#Gadget, #PB_Image_Border, 1)

Post 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
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

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

Post by Trond »

You could also use a frame3d gadget.
PureLust
Enthusiast
Enthusiast
Posts: 477
Joined: Mon Apr 16, 2007 3:57 am
Location: Germany, NRW

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

Post 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
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
Post Reply