Full Example

widget community.livecode.beaumont.pinkCircle metadata title is "My Pink Circle" metadata author is "Benjamin Beaumont" metadata version is "1.0.0" use com.livecode.canvas use com.livecode.widget use com.livecode.engine // Properties property circleMargin get mMargin set setMargin // Local variables private variable mMargin as Real public handler onCreate() put 0 into mMargin end handler public handler OnPaint() // Create a path with a radius of half the width of the canvas variable tCirclePath as Path put circle path centered at point [my width / 2, my height / 2] with radius (my width/2) into tCirclePath // Set the paint that will be used to fill the circle to a solid // pink color set the paint of this canvas to solid paint with color [1, 0, 1] // Fill the path fill tCirclePath on this canvas end handler public handler setMargin(in pMargin as Real) put pMargin into mMargin redraw all end handler end widget