Skip to content
Marcus Mascord edited this page Jul 15, 2014 · 5 revisions

The Polygon widget is almost the same as a Fragment widget, except that it draws a polygon instead of a rectangle.

The attributes for the Polygon widget are:

Attribute Type Description
m Widget The main Widget Class.
s WidgetStyle The style of the widget.
polygonString String This contains the co-ordinates of the polygon format example: "{10,10};{100,10},{100,100},{10,100}".
clickAction Function This is a function that is called when a user taps on the fragment. The function signature is function(Polygon Widget, x position of user tap, y position of user tap)
selectWidget Widget If this widget is not null, it allows the polygon to be selected instead on selecting the whole polygon. When this is selected, this widget is not returned but the polygon.
xLow Integer Specifies the polygon start x value. The default is 0.
yLow Integer Specifies the polygon start y value. The default is 0.

XML Polygon Widget Example

This is an example of the Polygon Widget written in XML. This shows a triangle Polygon:

<Widget>
	<Class>Polygon</Class>
	<AlignVert>CENTER</AlignVert>
	<AlignHoz>CENTER</AlignHoz>
	<Class>Polygon</Class>
	<Polygon>{200,0;400,400;0,400}</Polygon>
	<OffsetX>0</OffsetX>
	<OffsetY>0</OffsetY>
	<Style>
		<Colour>#000000</Colour>
		<Transparency>100</Transparency>
		<Gradient>
			<Colours>
				<Colour pos="0">#DF01D7</Colour>
				<Colour pos="1">#F7FE2E</Colour>
			</Colours>
			<StartX>2</StartX>
			<StartY>2</StartY>
			<EndX>100</EndX>
			<EndY>100</EndY>
		</Gradient>
	</Style>
</Widget>

The Polygon is shown as:

Clone this wiki locally