new Layers(Specifies)
The Layers object holds a collection of layers for the gauge control. Any layer can display unlimited opaque / transparent graphics, ex-HTML text, can be visible, selectable, dragable and so on. Any layer can change its position in the layers collection as well. The Layer can change its brightness, contrast, grayscale or transparency as well. Each layer can be defined by its key, so it can be easily accessed by the key. You can use the setter of the RadialMenu.Layers property to set the layers collection by a string-representation of the layers collection, or you can use the Layers.Add method to create and add a layer to the collection.
Parameters:
| Name | Type | Description |
|---|---|---|
Specifies |
RadialMenu | an object of RadialMenu type, owner of the layers collection. |
Members
Count :number
The Count property specifies the number of layers. The getter of the Count property returns the number of layers. The setter of the Count property specifies the number of layers. If the new number of layers is less than the current number, the extra layers will be removed from the end of the collection. If the new number of layers is greater than the current number, new layers will be added to the end of the collection. You can use the Item() method to get each layer and set its options.
You can use any of the following approaches to add layers to the collection:
- Use the setter of the RadialMenu.Layers property to set the layers collection by a string-representation of the layers collection
- Use the setter of the RadialMenu.Layers property to set the layers collection using an array of LayerOptions type or an array of any value that indicates the layer's key (layer's key or back)
- Use the Layers.Add method to create and add a layer to the collection
- Use the Layers.Count property to specify the number of layers, and then use the Item() method to get each layer and set its options
Type:
- number
Example
0 {number}, removes all layers from the collection
1 {number}, specifies that the collection contains one layer
n {number}, specifies that the collection contains n layers
Count
Methods
Add(oLayerOpts) → {Layer}
The Add() method creates and adds/gets a Layer object to the collection and returns a reference to the newly created object. The layer to be added or get if already exists can be specified by an object of LayerOptions type or by any value that indicates the key of the layer (layer's key or back). If the layer already exists and the oLayerOpts is an object of LayerOptions type, the layer's options will be updated with the oLayerOpts options. The Add method does not add a new layer if the layer already exists, but it returns the existing layer and updates its options in case the oLayerOpts is an object of LayerOptions type. The Remove method removes a specific member from the Layers collection.
Parameters:
| Name | Type | Description |
|---|---|---|
oLayerOpts |
LayerOptions | Specifies an object of LayerOptions type to create the layer with, or any value to specify the key of the layer to be added or get if already exists. If the layer already exists, the oLayerOpts will be used to update the layer's options in case it is an object of LayerOptions type. If the oLayerOpts is not an object of LayerOptions type, it will be used as a key to add or get the layer. |
Returns:
Returns an object of Layer type that has been added or get if already exists. If the layer already exists and the oLayerOpts is an object of LayerOptions type, the layer's options will be updated with the oLayerOpts options.
- Type
- Layer
Example
oRadialMenu.Layers.Add({back: "rgba(0,255,0,0.25)"}) {Layer}, creates and adds a layer filled with semi-transparent green color
oRadialMenu.Layers.Add({back: "gauge_back"}) {Layer}, creates and adds a layer filled with the picture specified by the "gauge_back" resource
Add
Clear()
The Clear() method removes all layers within the collection. The Remove() method removes a specific member from the Layers collection. You can use the Layer.Visible property to show or hide a layer instead of removing it from the collection. Removing a layer is useful when you don't need it anymore, as it releases the resources used by the layer.
Example
oRadialMenu.Layers.Clear(), removes all layers within the collection
Clear
Item(key) → {Layer}
The Item() method returns a specific Layer of the Layers collection. The layer to be returned can be specified by its index, key (layer's key or back) or by the Layer object itself. The method returns null if no layer with specified key exists, or an object of Layer type associated with the giving key. You can use the Item() and Count properties to enumerate all layers within the collection. The Item method is equivalent with the RadialMenu.Layer method.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
any | Specifies a integer expression that indicates the index of the layer to be requested, or any other value that indicates the key of the layer (layer's key or back). |
Returns:
Returns an object of Layer type associated with the giving index/key
- Type
- Layer
Example
The following statement are equivalent:
oRadialMenu.Layers.Item(0) {Layer}, returns the first layer within the collection
oRadialMenu.Layer(0) {Layer}, returns the first layer within the collection
where oRadialMenu is an object of RadialMenu type.
Item
Load(value)
The Load() method initializes the layers collection from its string representation. Setting the Layers property is equivalent to calling Load(), as it also assigns the layers using a string representation. The Save() method returns the current layers collection as a string representation. You can use Load() to restore the layers from a string, and Save() to retrieve the current state as a string. This representation is useful for saving, restoring, or assigning the layers collection (for example, via the RadialMenu.Layers property).
The format of the string representation for the layers collection is as follows:
"back[flag=value]...[flag=value],...,back[flag=value]...[flag=value],..."where:
- "back", (equivalent of Layer.Back property) could be:
- "" {empty string} (no layer background provided)
- "image" {picture's name}, defines the name of a picture previously added using the exontrol.HTMLPicture.Add(name,...) method. For instance, "pic" indciates that the HTML Picture named "pic" is stretched on the layer's background.
- "color" {string}, indicates a CSS color to be displayed on the layer's background. For instance, "red", "rgba(255,0,0,1)", "#FF0000" indicates a layer full-filed with a solid red-color.
The flag can be any of the following:
Flag Description Sample [a] rotation angle in degree. Angle 0 is considered the 12 o'clock direction, and it increases clockwise, so 90 degrees is considered the 3 o'clock direction, 180 degrees the 6 o'clock direction, and 270 degrees (or -90 degrees) the 9 o'clock direction. A positive value rotates the layer clockwise, while a negative value rotates it counter-clockwise (equivalent of Layer.RotateAngle property) [a=90] [a2v] converts rotation angle to value using a format-expression, where "value" keyword represents the Layer.Value property, so the Layer.Value property is calculated based on the rotation angle. For instance, [a2v=value/360*100] means that the value is calculated as a percentage of the rotation angle, where 0 degree corresponds to 0% and 360 degrees corresponds to 100%. This flag is useful when you want to link the layer's value to its rotation angle, such as in a gauge control where the needle's position (rotation) represents a certain value (equivalent of Layer.RotateAngleToValue property) [a2v=value/360*100] [aValid] validates, limits or snaps the rotation angle of the layer, using a format-expression, where "value" keyword represents the Layer.Value property. For instance, if you want to snap the rotation angle of the layer to multiples of 5 degrees, you can set the rotateAngleValid field to "round(value/5)*5" (equivalent of Layer.RotateAngleValid property) [aValid=value<90?value:90] [brightness.blue] adjusts the blue channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.blue=value] means that the blue channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the blue channel will adjust accordingly (equivalent of LayerColorAdjustment.Blue property, Brightness property) [brightness.blue=100-value] [brightness.green] adjusts the green channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.green=value] means that the green channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the green channel will adjust accordingly (equivalent of LayerColorAdjustment.Green property, Brightness property) [brightness.green=100] [brightness.red] adjusts the red channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.red=value] means that the red channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the red channel will adjust accordingly (equivalent of LayerColorAdjustment.Red property, Brightness property) [brightness.red=100] [cLayer] defines the index or the key of the layer used as a reference for the layer's rotation center. For instance, [cLayer=-1] means that the rotation center is defined relative to the layer itself, so it remains fixed regardless of any movement or rotation of other layers. This flag is useful when you want to create complex interactions between layers, such as having one layer rotate around another layer or around a fixed point on the control (equivalent of Layer.RotateCenterLayer property) [cLayer=-1] [clip] specifies the type of the clipping region the current layer supports as "Rect","RoundRect","Ellipse" or "Pie". Once the clip type is specified, you can use the other clip-related flags to define the size, position, and shape of the clipping region. For instance, if you set [clip=Ellipse], you can then specify the ellipse's X and Y radius using [clip.radiusX] and [clip.radiusY], as well as its center position using [clip.xCenter] and [clip.yCenter] (equivalent of LayerClip.Clip property) [clip=Ellipse] [clip.height] defines the height of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.height=120] means that the clipping region has a fixed height of 120 pixels, while [clip.height=value] means that the clipping region's height is directly linked to the clip's value, so as the value changes, the height of the clipping region will adjust accordingly (equivalent of LayerClip.Height property) [clip.height=120] [clip.left] defines the left position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.left=120] means that the clipping region's left edge is positioned at 120 pixels from the left edge of the layer, while [clip.left=value] means that the left position of the clipping region is directly linked to the clip's value, so as the value changes, the left position of the clipping region will adjust accordingly (equivalent of LayerClip.Left property) [clip.left=120] [clip.radiusX] defines the X radius of the clipping region for ellipse or pie clip types, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.radiusX=120] means that the ellipse's X radius is fixed at 120 pixels, while [clip.radiusX=value] means that the ellipse's X radius is directly linked to the clip's value, so as the value changes, the X radius of the ellipse will adjust accordingly (equivalent of LayerClip.RadiusX property) [clip.radiusX=128] [clip.radiusY] defines the Y radius of the clipping region for ellipse or pie clip types, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.radiusY=120] means that the ellipse's Y radius is fixed at 120 pixels, while [clip.radiusY=value] means that the ellipse's Y radius is directly linked to the clip's value, so as the value changes, the Y radius of the ellipse will adjust accordingly (equivalent of LayerClip.RadiusY property) [clip.radiusY=128] [clip.roundX] defines the round rect X radius of the clipping region for round rect clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.roundX=120] means that the round rect's X radius is fixed at 120 pixels, while [clip.roundX=value] means that the round rect's X radius is directly linked to the clip's value, so as the value changes, the X radius of the round rect will adjust accordingly (equivalent of LayerClip.RoundRadiusX property) [clip.roundX=16] [clip.roundY] defines the round rect Y radius of the clipping region for round rect clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.roundY=120] means that the round rect's Y radius is fixed at 120 pixels, while [clip.roundY=value] means that the round rect's Y radius is directly linked to the clip's value, so as the value changes, the Y radius of the round rect will adjust accordingly (equivalent of LayerClip.RoundRadiusY property) [clip.roundY=16] [clip.start] defines the start angle of the clipping region for pie clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.start=120] means that the pie's start angle is fixed at 120 degrees, while [clip.start=value] means that the pie's start angle is directly linked to the clip's value, so as the value changes, the start angle of the pie will adjust accordingly (equivalent of LayerClip.StartAngle property) [clip.start=-45] [clip.sweep] defines the sweep angle of the clipping region for pie clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.sweep=120] means that the pie's sweep angle is fixed at 120 degrees, while [clip.sweep=value] means that the pie's sweep angle is directly linked to the clip's value, so as the value changes, the sweep angle of the pie will adjust accordingly (equivalent of LayerClip.SweepAngle property) [clip.sweep=45] [clip.top] defines the top position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.top=120] means that the clipping region's top edge is positioned at 120 pixels from the top edge of the layer, while [clip.top=value] means that the top position of the clipping region is directly linked to the clip's value, so as the value changes, the top position of the clipping region will adjust accordingly (equivalent of LayerClip.Top property) [clip.top=120] [clip.value] value used for clip expressions as it can be a hard-coded value or the RadialMenu.Value property if not specified. For instance, if you set [clip.value=50], the "value" keyword used in other clip-related expressions will be replaced by 50 (equivalent of LayerClip.Value property) [clip.value=50] [clip.width] defines the width of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.width=120] means that the clipping region has a fixed width of 120 pixels, while [clip.width=value] means that the clipping region's width is directly linked to the clip's value, so as the value changes, the width of the clipping region will adjust accordingly (equivalent of LayerClip.Width property) [clip.width=120] [clip.x] defines the X offset of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.x=120] means that the clipping region is offset by 120 pixels from the left edge of the layer, while [clip.x=value] means that the X offset of the clipping region is directly linked to the clip's value, so as the value changes, the X offset of the clipping region will adjust accordingly (equivalent of LayerClip.OffsetX property) [clip.x=120] [clip.xCenter] defines the center X position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.xCenter=120] means that the clipping region's center is positioned at 120 pixels from the left edge of the layer, while [clip.xCenter=value] means that the center X position of the clipping region is directly linked to the clip's value, so as the value changes, the center X position of the clipping region will adjust accordingly (equivalent of LayerClip.CenterX property) [clip.xCenter=128] [clip.y] defines the Y offset of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.y=120] means that the clipping region is offset by 120 pixels from the top edge of the layer, while [clip.y=value] means that the Y offset of the clipping region is directly linked to the clip's value, so as the value changes, the Y offset of the clipping region will adjust accordingly (equivalent of LayerClip.OffsetY property) [clip.y=-120] [clip.yCenter] defines the center Y position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.yCenter=120] means that the clipping region's center is positioned at 120 pixels from the top edge of the layer, while [clip.yCenter=value] means that the center Y position of the clipping region is directly linked to the clip's value, so as the value changes, the center Y position of the clipping region will adjust accordingly (equivalent of LayerClip.CenterY property) [clip.yCenter=128] [contrast.blue] adjusts the blue channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.blue=100-value] means that the blue channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the blue channel decreases accordingly (equivalent of LayerColorAdjustment.Blue property, Contrast property) [contrast.blue=100-value] [contrast.green] adjusts the green channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.green=100-value] means that the green channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the green channel decreases accordingly (equivalent of LayerColorAdjustment.Green property, Contrast property) [contrast.green=100-value] [contrast.red] adjusts the red channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.red=100-value] means that the red channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the red channel decreases accordingly (equivalent of LayerColorAdjustment.Red property, Contrast property) [contrast.red=100-value] [defA] default rotation angle in degree. Angle 0 is considered the 12 o'clock direction, and it increases clockwise, so 90 degrees is considered the 3 o'clock direction, 180 degrees the 6 o'clock direction, and 270 degrees (or -90 degrees) the 9 o'clock direction. A positive value rotates the layer clockwise, while a negative value rotates it counter-clockwise (equivalent of Layer.DefaultRotateAngle property) [defA=45] [defX] default x-offset of the layer. The layer's actual x-offset is the sum of left, defaultOffsetX, and offsetX, while the actual y-offset is the sum of top, defaultOffsetY, and offsetY. For instance, if you set the defaultOffsetX field to 10, the offsetX field to 5, the layer is shown with a total x-offset of 15 pixels from the position specified by the left field (equivalent of Layer.DefaultOffsetX property) [defX=-32] [defY] default y-offset of the layer. The layer's actual y-offset is the sum of top, defaultOffsetY, and offsetY, while the actual x-offset is the sum of left, defaultOffsetX, and offsetX. For instance, if you set the defaultOffsetY field to 10, the offsetY field to 5, the layer is shown with a total y-offset of 15 pixels from the position specified by the top field (equivalent of Layer.DefaultOffsetY property) [defY=-32] [drag] defines the transformation of the layer (move, rotate, rota-move) once the user drags it. For instance, if you set the drag flag to "move", the layer is moved according to the mouse movement once the user drags it, while if you set it to "rotate", the layer is rotated according to the mouse movement once the user drags it (equivalent of Layer.OnDrag property) [drag=rotate] [fore] defines a format expression to display the layer's ex-HTML caption in the foreground of the layer, where "value" keyword represents the Layer.Value property, so the caption is calculated based on the value. For instance, [fore=round(value)] means that the caption is calculated as the rounded value of the layer's value, so if the layer's value is 15.6, the caption becomes 16 (equivalent of Layer.Fore property) [fore=round(value)] [fore.front] shows the layer's ex-HTML caption in front or back of the layer. For instance, [fore.front=0] means that the layer's caption is shown behind the layer, so it is partially or fully hidden based on the layer's background (equivalent of front flag of Layer.ForeOpt property) [fore.front=0] [fore.tfi] defines the layer's font attributes (font name, size, color, and style). For instance, [fore.tfi=bold 14 Arial <fgcolor red>] means that the layer's caption is shown in bold 14px Arial font with red color (equivalent of tfi flag of Layer.ForeOpt property) [fore.tfi=bold] [fore.format] specifies the format of the text drawn in the layer's foreground. For instance [fore.format=single,right,bottom] means that the layer's caption is shown as a single line right/bottom-aligned (equivalent of format flag of Layer.ForeOpt property) [fore.format=single,right,bottom] [fore.left] shifts the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.left=16] means that the layer's caption is shifted 16 pixels from its default position (equivalent of left flag of Layer.ForeOpt property) [fore.left=16] [fore.top] shifts the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.top=16] means that the layer's caption is shifted 16 pixels from its default position (equivalent of top flag of Layer.ForeOpt property) [fore.top=16] [fore.width] defines the maximum width of the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.width=100] means that the layer's caption is shown with a maximum width of 100 pixels, so if the caption exceeds 100 pixels in width, it is wrapped to multiple lines or truncated based on the formatText flag (equivalent of width flag of Layer.ForeOpt property) [fore.width=100] [fore.height] defines the maximum height of the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.height=100] means that the layer's caption is shown with a maximum height of 100 pixels, so if the caption exceeds 100 pixels in height, it is wrapped to multiple lines or truncated based on the formatText flag (equivalent of height flag of Layer.ForeOpt property) [fore.height=100] [grayscale] grayscale level of the layer, as a percent value or a format-expression, where "value" keyword represents the Layer.Value property, so the grayscale level of the layer is calculated based on the value. For instance, "value" expression means that the grayscale level is equal to the value of the layer, so if you set the layer's value to 0, it is shown in full color, while if you set it to 100, it is shown in full grayscale (equivalent of Layer.Grayscale property) [grayscale=100] [height] height of the layer using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "height/4" expression sets the layer's height to a quarter of the control's height (equivalent of Layer.Height property) [height=height/4] [idem] synchronizes offset/rotation across layers. For instance, "knob,knob2", once you move or rotate one of the layers with key "knob" or "knob2", the other layer is moved or rotated as well, to ensure that both layers have the same offset and rotation angle. The rotateAngle, offsetX, and offsetY fields of all layers included in the idem group are set to the same value, which is the value of the layer that is moved or rotated (equivalent of Layer.Idem property) [idem=knob,knob2] [key] defines the key of the layer, which is used to identify the layer and reference it from other layers. For instance, "hourHand", "minuteHand", and "secondHand" are keys that can be used to identify the layers of a clock control, so you can set the hour hand's rotation angle based on the current hour, the minute hand's rotation angle based on the current minute, and the second hand's rotation angle based on the current second (equivalent of Layer.Key property) [key=needle] [left] left horizontal offset using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "width/2" expression places the layer at the horizontal middle of the control (equivalent of Layer.Left property) [left=width/2] [o2v] converts the current x- and y-offset to a value using a format-expression, where "x" and "y" keywords represent the layer's x- and y-offset respectively. For instance, "(x+y)/2" expression calculates the value as the sum of the x-offset and half of the y-offset, so if you set the layer's x-offset to 10 and y-offset to 20, the value becomes 15 (equivalent of Layer.OffsetToValue property) [o2v=x+y/2] [pos] defines the z-order position of the layer(0-based). For instance, if you have three layers and you set the pos flag of one of the layers to 0, that layer is shown at the bottom, while if you set it to 2, that layer is shown at the top (equivalent of Layer.Position property) [pos=0] [rotateclip] rotates clipping region along with the layer. For instance, if you set the rotateclip flag to 1 for a layer with a pie clipping region, when you rotate the layer, the pie clipping region rotates as well, so the visible part of the layer changes as it rotates. This flag is useful when you want to create dynamic visual effects where the visibility of the layer changes based on its rotation (equivalent of Layer.RotateClip property) [rotateclip=1] [sel] makes the layer selectable or not. The user can not move or rotate the layer using mouse if the layer is not selectable. Setting the sel flag to 0 makes the layer not selectable, while setting it to 1 makes the layer selectable (equivalent of Layer.Selectable property) [sel=0] [top] top vertical offset using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "height/2" expression places the layer at the vertical middle of the control (equivalent of Layer.Top property) [top=height/2] [transparency] transparency of the layer, as a percent value or a format-expression, where "value" keyword represents the Layer.Value property, so the transparency of the layer is calculated based on the value. For instance, "100-value" expression makes the layer more transparent as the value increases, so if you set the layer's value to 0, it is fully opaque, while if you set it to 100, it is fully transparent (equivalent of Layer.Transparency property) [transparency=100-value] [value] defines the value of the layer, which can be the offset to move the layer, the angle to rotate the layer. For instance, 15 may shift the layer 15 pixels from its default position, or rotate the layer 15 degrees from its default angle, depending on how the layer is configured to interpret the value (equivalent of Layer.Value property) [value=15] [vis] shows or hides the layer. Setting the vis flag to 0 hides the layer, while setting it to 1 shows the layer (equivalent of Layer.Visible property) [vis=0] [v2a] converts value to rotation angle using a format-expression, where "value" keyword represents the Layer.Value property, so the Layer.Value property is calculated based on the value. For instance, "value/100*360" expression remaps the layer's value in a 0 - 100 range to a rotation angle in a 0 - 360 range, so if you set the layer's value to 25, it is rotated 90 degrees, and if you rotate the layer 180 degrees, its value becomes 50 (equivalent of Layer.ValueToRotateAngle property) [v2a=value/100*360] [v2x] converts value to x-offset, using a format-expression, where "value" keyword represents the Layer.Value property, so the x-offset of the layer is calculated based on the value. For instance, "(value=0)?0:48", means that if the layer's value is 0, the x-offset is 0, otherwise it is 48 pixels. This flag is useful when you want to link the layer's horizontal position to its value, such as in a switch control where the knob's position (x-offset) represents the on/off state (value) of the switch (equivalent of Layer.ValueToOffsetX property) [v2x=(value=0)?0:48] [v2y] converts value to y-offset, using a format-expression, where "value" keyword represents the Layer.Value property, so the y-offset of the layer is calculated based on the value. For instance, "(value=0)?0:48", means that if the layer's value is 0, the y-offset is 0, otherwise it is 48 pixels. This flag is useful when you want to link the layer's vertical position to its value, such as in a switch control where the knob's position (y-offset) represents the on/off state (value) of the switch (equivalent of Layer.ValueToOffsetY property) [v2y=(value=0)?0:48] [width] width of the layer using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "width/4" expression sets the layer's width to a quarter of the control's width (equivalent of Layer.Width property) [width=width/4] [x] x-offset of layer. The layer's actual x-offset is the sum of left, defaultOffsetX, and offsetX, while the actual y-offset is the sum of top, defaultOffsetY, and offsetY. For instance, if you set the offsetX field to 10, the defaultOffsetX field to 5, the layer is shown with a total x-offset of 15 pixels from the position specified by the left field (equivalent of Layer.OffsetX property) [x=-32] [xCenter] defines the x-coordinate of the rotation center relative to the layer specified by the Layer.RotateCenterLayer property, using a format expression where "lwidth" or "width" represents the layer's width in pixels and "lheight" or "height" represents its height, so "lwidth/2" places the rotation center at the horizontal middle of the layer (equivalent of Layer.RotateCenterX property) [xCenter=lwidth/2] [xValid] validates, limits or spans the x-offset value of the layer, using a format-expression, where is supports "x" (x-offset value of the layer), "y" (y-offset value of the layer), "lwidth" (layer's width in pixels), "lheight" (layer's height in pixels), "width" (control's width in pixels), "height" (control's height in pixels) and "value" (can be x- or y-offset) keywords. For instance, if you set the offsetXValid field to "x MIN 0 MAX 48", the offsetX field is validated to be between 0 and 48 pixels, while "round(x/8)*8" expression spans the offsetX value to the closest multiple of 8 pixels (equivalent of Layer.OffsetXValid property) [xValid=x MIN 0 MAX 48] [y] y-offset of layer. The layer's actual y-offset is the sum of top, defaultOffsetY, and offsetY, while the actual x-offset is the sum of left, defaultOffsetX, and offsetX. For instance, if you set the offsetY field to 10, the defaultOffsetY field to 5, the layer is shown with a total y-offset of 15 pixels from the position specified by the top field (equivalent of Layer.OffsetY property) [y=-32] [yCenter] definex the y-coordinate of the rotation center relative to the layer specified by the Layer.RotateCenterLayer property, using a format expression where "lwidth" or "width" represents the layer's width in pixels and "lheight" or "height" represents its height, so "lheight/2" places the rotation center at the vertical middle of the layer (equivalent of Layer.RotateCenterY property) [yCenter=lheight/2] [yValid] validates, limits or spans the y-offset value of the layer, using a format-expression, where is supports "x" (x-offset value of the layer), "y" (y-offset value of the layer), "lwidth" (layer's width in pixels), "lheight" (layer's height in pixels), "width" (control's width in pixels), "height" (control's height in pixels) and "value" (can be x- or y-offset) keywords. For instance, if you set the offsetYValid field to "y MIN 0 MAX 48", the offsetY field is validated to be between 0 and 48 pixels, while "round(y/8)*8" expression spans the offsetY value to the closest multiple of 8 pixels (equivalent of Layer.OffsetYValid property) [yValid=y MIN 0 MAX 48]
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | Specifies the string-representation to get the control's layers from, as explained in the table above. For instance, [key=needle,fore=round(value),fore.tfi=bold 14 Arial <fgcolor red>,v2a=value/100*360] represents a layer with key "needle", whose caption is the rounded value of the layer's value shown in bold 14px Arial font with red color, and its rotation angle is calculated by remapping the layer's value in a 0 - 100 range to a rotation angle in a 0 - 360 range. |
Example
"gauge_back[yCenter=lheight/2 + 78],gauge_needle[key=needle][avalid=value < 90 ? value : (value < 180 ? 90 : ( value < 270 ? 270 : value ))][a2v=value >= 270 ? (value - 270)/90*50 : (value/90)*50 + 50][v2a=value < 50 ? (270 + value/50*90) : (value - 50)/50 * 90][drag=rotate]", {string} defines a gauge control
"vista_back,vista_hour[key=hour][drag=rotate][v2a=2*360*( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)))][a2v=value/360 * 0.5],vista_min[key=min][sel=0][drag=rotate][v2a=((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360][a2v=value / 360 / 24 / 60],vista_sec[v2a=((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360][a2v=value / 360 / 24 / 60][drag=rotate][key=sec][sel=0]", {string} defines a clock control
Load
Remove(key)
The Remove() method removes a specific member from the Layers collection. The layer to be removed can be specified by its index, key (layer's key or back) or by the Layer object itself. The Clear() method removes all layers within the collection. You can use the Layer.Visible property to show or hide a layer instead of removing it from the collection. Removing a layer is useful when you don't need it anymore, as it releases the resources used by the layer.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
any | Specifies an integer expression that indicates the index of the layer to be removed, or any other value that indicates the key of the layer (layer's key or back), or the Layer object itself to be removed. |
Example
The following statement are equivalent:
oRadialMenu.Layers.Remove(0), removes the first layer within the collection
oRadialMenu.Layer(0).Remove(), removes the first layer within the collection
where oRadialMenu is an object of RadialMenu type.
Remove
Save() → {string}
The Save() method saves the layers into a string-representation. The string-representation of the layers includes the caption and the flags of each layer, as explained in the table above. For instance, [key=needle,fore=round(value),fore.tfi=bold 14 Arial <fgcolor red>,v2a=value/100*360] represents a layer with key "needle", whose caption is the rounded value of the layer's value shown in bold 14px Arial font with red color, and its rotation angle is calculated by remapping the layer's value in a 0 - 100 range to a rotation angle in a 0 - 360 range.
The format of the string representation for the layers collection is as follows:
"back[flag=value]...[flag=value],...,back[flag=value]...[flag=value],..."where:
- "back", (equivalent of Layer.Back property) could be:
- "" {empty string} (no layer background provided)
- "image" {picture's name}, defines the name of a picture previously added using the exontrol.HTMLPicture.Add(name,...) method. For instance, "pic" indciates that the HTML Picture named "pic" is stretched on the layer's background.
- "color" {string}, indicates a CSS color to be displayed on the layer's background. For instance, "red", "rgba(255,0,0,1)", "#FF0000" indicates a layer full-filed with a solid red-color.
The flag can be any of the following:
Flag Description Sample [a] rotation angle in degree. Angle 0 is considered the 12 o'clock direction, and it increases clockwise, so 90 degrees is considered the 3 o'clock direction, 180 degrees the 6 o'clock direction, and 270 degrees (or -90 degrees) the 9 o'clock direction. A positive value rotates the layer clockwise, while a negative value rotates it counter-clockwise (equivalent of Layer.RotateAngle property) [a=90] [a2v] converts rotation angle to value using a format-expression, where "value" keyword represents the Layer.Value property, so the Layer.Value property is calculated based on the rotation angle. For instance, [a2v=value/360*100] means that the value is calculated as a percentage of the rotation angle, where 0 degree corresponds to 0% and 360 degrees corresponds to 100%. This flag is useful when you want to link the layer's value to its rotation angle, such as in a gauge control where the needle's position (rotation) represents a certain value (equivalent of Layer.RotateAngleToValue property) [a2v=value/360*100] [aValid] validates, limits or snaps the rotation angle of the layer, using a format-expression, where "value" keyword represents the Layer.Value property. For instance, if you want to snap the rotation angle of the layer to multiples of 5 degrees, you can set the rotateAngleValid field to "round(value/5)*5" (equivalent of Layer.RotateAngleValid property) [aValid=value<90?value:90] [brightness.blue] adjusts the blue channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.blue=value] means that the blue channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the blue channel will adjust accordingly (equivalent of LayerColorAdjustment.Blue property, Brightness property) [brightness.blue=100-value] [brightness.green] adjusts the green channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.green=value] means that the green channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the green channel will adjust accordingly (equivalent of LayerColorAdjustment.Green property, Brightness property) [brightness.green=100] [brightness.red] adjusts the red channel brightness using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [brightness.red=value] means that the red channel brightness is directly linked to the layer's value, so as the value changes, the brightness of the red channel will adjust accordingly (equivalent of LayerColorAdjustment.Red property, Brightness property) [brightness.red=100] [cLayer] defines the index or the key of the layer used as a reference for the layer's rotation center. For instance, [cLayer=-1] means that the rotation center is defined relative to the layer itself, so it remains fixed regardless of any movement or rotation of other layers. This flag is useful when you want to create complex interactions between layers, such as having one layer rotate around another layer or around a fixed point on the control (equivalent of Layer.RotateCenterLayer property) [cLayer=-1] [clip] specifies the type of the clipping region the current layer supports as "Rect","RoundRect","Ellipse" or "Pie". Once the clip type is specified, you can use the other clip-related flags to define the size, position, and shape of the clipping region. For instance, if you set [clip=Ellipse], you can then specify the ellipse's X and Y radius using [clip.radiusX] and [clip.radiusY], as well as its center position using [clip.xCenter] and [clip.yCenter] (equivalent of LayerClip.Clip property) [clip=Ellipse] [clip.height] defines the height of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.height=120] means that the clipping region has a fixed height of 120 pixels, while [clip.height=value] means that the clipping region's height is directly linked to the clip's value, so as the value changes, the height of the clipping region will adjust accordingly (equivalent of LayerClip.Height property) [clip.height=120] [clip.left] defines the left position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.left=120] means that the clipping region's left edge is positioned at 120 pixels from the left edge of the layer, while [clip.left=value] means that the left position of the clipping region is directly linked to the clip's value, so as the value changes, the left position of the clipping region will adjust accordingly (equivalent of LayerClip.Left property) [clip.left=120] [clip.radiusX] defines the X radius of the clipping region for ellipse or pie clip types, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.radiusX=120] means that the ellipse's X radius is fixed at 120 pixels, while [clip.radiusX=value] means that the ellipse's X radius is directly linked to the clip's value, so as the value changes, the X radius of the ellipse will adjust accordingly (equivalent of LayerClip.RadiusX property) [clip.radiusX=128] [clip.radiusY] defines the Y radius of the clipping region for ellipse or pie clip types, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.radiusY=120] means that the ellipse's Y radius is fixed at 120 pixels, while [clip.radiusY=value] means that the ellipse's Y radius is directly linked to the clip's value, so as the value changes, the Y radius of the ellipse will adjust accordingly (equivalent of LayerClip.RadiusY property) [clip.radiusY=128] [clip.roundX] defines the round rect X radius of the clipping region for round rect clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.roundX=120] means that the round rect's X radius is fixed at 120 pixels, while [clip.roundX=value] means that the round rect's X radius is directly linked to the clip's value, so as the value changes, the X radius of the round rect will adjust accordingly (equivalent of LayerClip.RoundRadiusX property) [clip.roundX=16] [clip.roundY] defines the round rect Y radius of the clipping region for round rect clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.roundY=120] means that the round rect's Y radius is fixed at 120 pixels, while [clip.roundY=value] means that the round rect's Y radius is directly linked to the clip's value, so as the value changes, the Y radius of the round rect will adjust accordingly (equivalent of LayerClip.RoundRadiusY property) [clip.roundY=16] [clip.start] defines the start angle of the clipping region for pie clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.start=120] means that the pie's start angle is fixed at 120 degrees, while [clip.start=value] means that the pie's start angle is directly linked to the clip's value, so as the value changes, the start angle of the pie will adjust accordingly (equivalent of LayerClip.StartAngle property) [clip.start=-45] [clip.sweep] defines the sweep angle of the clipping region for pie clip type, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.sweep=120] means that the pie's sweep angle is fixed at 120 degrees, while [clip.sweep=value] means that the pie's sweep angle is directly linked to the clip's value, so as the value changes, the sweep angle of the pie will adjust accordingly (equivalent of LayerClip.SweepAngle property) [clip.sweep=45] [clip.top] defines the top position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.top=120] means that the clipping region's top edge is positioned at 120 pixels from the top edge of the layer, while [clip.top=value] means that the top position of the clipping region is directly linked to the clip's value, so as the value changes, the top position of the clipping region will adjust accordingly (equivalent of LayerClip.Top property) [clip.top=120] [clip.value] value used for clip expressions as it can be a hard-coded value or the RadialMenu.Value property if not specified. For instance, if you set [clip.value=50], the "value" keyword used in other clip-related expressions will be replaced by 50 (equivalent of LayerClip.Value property) [clip.value=50] [clip.width] defines the width of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.width=120] means that the clipping region has a fixed width of 120 pixels, while [clip.width=value] means that the clipping region's width is directly linked to the clip's value, so as the value changes, the width of the clipping region will adjust accordingly (equivalent of LayerClip.Width property) [clip.width=120] [clip.x] defines the X offset of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.x=120] means that the clipping region is offset by 120 pixels from the left edge of the layer, while [clip.x=value] means that the X offset of the clipping region is directly linked to the clip's value, so as the value changes, the X offset of the clipping region will adjust accordingly (equivalent of LayerClip.OffsetX property) [clip.x=120] [clip.xCenter] defines the center X position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.xCenter=120] means that the clipping region's center is positioned at 120 pixels from the left edge of the layer, while [clip.xCenter=value] means that the center X position of the clipping region is directly linked to the clip's value, so as the value changes, the center X position of the clipping region will adjust accordingly (equivalent of LayerClip.CenterX property) [clip.xCenter=128] [clip.y] defines the Y offset of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.y=120] means that the clipping region is offset by 120 pixels from the top edge of the layer, while [clip.y=value] means that the Y offset of the clipping region is directly linked to the clip's value, so as the value changes, the Y offset of the clipping region will adjust accordingly (equivalent of LayerClip.OffsetY property) [clip.y=-120] [clip.yCenter] defines the center Y position of the clipping region, using a format-expression that supports "value" (specifies the Clip.Value if specified otherwise the RadialMenu.Value property), "width" or "lwidth" (indicates the width in pixels of the layer), "height" or "lheight" (indicates the height in pixels of the layer) keywords. For instance, [clip.yCenter=120] means that the clipping region's center is positioned at 120 pixels from the top edge of the layer, while [clip.yCenter=value] means that the center Y position of the clipping region is directly linked to the clip's value, so as the value changes, the center Y position of the clipping region will adjust accordingly (equivalent of LayerClip.CenterY property) [clip.yCenter=128] [contrast.blue] adjusts the blue channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.blue=100-value] means that the blue channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the blue channel decreases accordingly (equivalent of LayerColorAdjustment.Blue property, Contrast property) [contrast.blue=100-value] [contrast.green] adjusts the green channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.green=100-value] means that the green channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the green channel decreases accordingly (equivalent of LayerColorAdjustment.Green property, Contrast property) [contrast.green=100-value] [contrast.red] adjusts the red channel contrast using a percentage value or a format-expression, where "value" keyword represents the Layer.Value property. For instance, [contrast.red=100-value] means that the red channel contrast is inversely linked to the layer's value, so as the value increases, the contrast of the red channel decreases accordingly (equivalent of LayerColorAdjustment.Red property, Contrast property) [contrast.red=100-value] [defA] default rotation angle in degree. Angle 0 is considered the 12 o'clock direction, and it increases clockwise, so 90 degrees is considered the 3 o'clock direction, 180 degrees the 6 o'clock direction, and 270 degrees (or -90 degrees) the 9 o'clock direction. A positive value rotates the layer clockwise, while a negative value rotates it counter-clockwise (equivalent of Layer.DefaultRotateAngle property) [defA=45] [defX] default x-offset of the layer. The layer's actual x-offset is the sum of left, defaultOffsetX, and offsetX, while the actual y-offset is the sum of top, defaultOffsetY, and offsetY. For instance, if you set the defaultOffsetX field to 10, the offsetX field to 5, the layer is shown with a total x-offset of 15 pixels from the position specified by the left field (equivalent of Layer.DefaultOffsetX property) [defX=-32] [defY] default y-offset of the layer. The layer's actual y-offset is the sum of top, defaultOffsetY, and offsetY, while the actual x-offset is the sum of left, defaultOffsetX, and offsetX. For instance, if you set the defaultOffsetY field to 10, the offsetY field to 5, the layer is shown with a total y-offset of 15 pixels from the position specified by the top field (equivalent of Layer.DefaultOffsetY property) [defY=-32] [drag] defines the transformation of the layer (move, rotate, rota-move) once the user drags it. For instance, if you set the drag flag to "move", the layer is moved according to the mouse movement once the user drags it, while if you set it to "rotate", the layer is rotated according to the mouse movement once the user drags it (equivalent of Layer.OnDrag property) [drag=rotate] [fore] defines a format expression to display the layer's ex-HTML caption in the foreground of the layer, where "value" keyword represents the Layer.Value property, so the caption is calculated based on the value. For instance, [fore=round(value)] means that the caption is calculated as the rounded value of the layer's value, so if the layer's value is 15.6, the caption becomes 16 (equivalent of Layer.Fore property) [fore=round(value)] [fore.front] shows the layer's ex-HTML caption in front or back of the layer. For instance, [fore.front=0] means that the layer's caption is shown behind the layer, so it is partially or fully hidden based on the layer's background (equivalent of front flag of Layer.ForeOpt property) [fore.front=0] [fore.tfi] defines the layer's font attributes (font name, size, color, and style). For instance, [fore.tfi=bold 14 Arial <fgcolor red>] means that the layer's caption is shown in bold 14px Arial font with red color (equivalent of tfi flag of Layer.ForeOpt property) [fore.tfi=bold] [fore.format] specifies the format of the text drawn in the layer's foreground. For instance [fore.format=single,right,bottom] means that the layer's caption is shown as a single line right/bottom-aligned (equivalent of format flag of Layer.ForeOpt property) [fore.format=single,right,bottom] [fore.left] shifts the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.left=16] means that the layer's caption is shifted 16 pixels from its default position (equivalent of left flag of Layer.ForeOpt property) [fore.left=16] [fore.top] shifts the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.top=16] means that the layer's caption is shifted 16 pixels from its default position (equivalent of top flag of Layer.ForeOpt property) [fore.top=16] [fore.width] defines the maximum width of the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.width=100] means that the layer's caption is shown with a maximum width of 100 pixels, so if the caption exceeds 100 pixels in width, it is wrapped to multiple lines or truncated based on the formatText flag (equivalent of width flag of Layer.ForeOpt property) [fore.width=100] [fore.height] defines the maximum height of the layer's caption using a hard-coded value or a value calculated from a format-expression, where "twidth" (indicates the caption's width in pixels), "theight" (indicates the caption's height in pixels), "width" (indicates the layer's width) in pixels and "height" indicates the control's height in pixels. For instance, [fore.height=100] means that the layer's caption is shown with a maximum height of 100 pixels, so if the caption exceeds 100 pixels in height, it is wrapped to multiple lines or truncated based on the formatText flag (equivalent of height flag of Layer.ForeOpt property) [fore.height=100] [grayscale] grayscale level of the layer, as a percent value or a format-expression, where "value" keyword represents the Layer.Value property, so the grayscale level of the layer is calculated based on the value. For instance, "value" expression means that the grayscale level is equal to the value of the layer, so if you set the layer's value to 0, it is shown in full color, while if you set it to 100, it is shown in full grayscale (equivalent of Layer.Grayscale property) [grayscale=100] [height] height of the layer using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "height/4" expression sets the layer's height to a quarter of the control's height (equivalent of Layer.Height property) [height=height/4] [idem] synchronizes offset/rotation across layers. For instance, "knob,knob2", once you move or rotate one of the layers with key "knob" or "knob2", the other layer is moved or rotated as well, to ensure that both layers have the same offset and rotation angle. The rotateAngle, offsetX, and offsetY fields of all layers included in the idem group are set to the same value, which is the value of the layer that is moved or rotated (equivalent of Layer.Idem property) [idem=knob,knob2] [key] defines the key of the layer, which is used to identify the layer and reference it from other layers. For instance, "hourHand", "minuteHand", and "secondHand" are keys that can be used to identify the layers of a clock control, so you can set the hour hand's rotation angle based on the current hour, the minute hand's rotation angle based on the current minute, and the second hand's rotation angle based on the current second (equivalent of Layer.Key property) [key=needle] [left] left horizontal offset using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "width/2" expression places the layer at the horizontal middle of the control (equivalent of Layer.Left property) [left=width/2] [o2v] converts the current x- and y-offset to a value using a format-expression, where "x" and "y" keywords represent the layer's x- and y-offset respectively. For instance, "(x+y)/2" expression calculates the value as the sum of the x-offset and half of the y-offset, so if you set the layer's x-offset to 10 and y-offset to 20, the value becomes 15 (equivalent of Layer.OffsetToValue property) [o2v=x+y/2] [pos] defines the z-order position of the layer(0-based). For instance, if you have three layers and you set the pos flag of one of the layers to 0, that layer is shown at the bottom, while if you set it to 2, that layer is shown at the top (equivalent of Layer.Position property) [pos=0] [rotateclip] rotates clipping region along with the layer. For instance, if you set the rotateclip flag to 1 for a layer with a pie clipping region, when you rotate the layer, the pie clipping region rotates as well, so the visible part of the layer changes as it rotates. This flag is useful when you want to create dynamic visual effects where the visibility of the layer changes based on its rotation (equivalent of Layer.RotateClip property) [rotateclip=1] [sel] makes the layer selectable or not. The user can not move or rotate the layer using mouse if the layer is not selectable. Setting the sel flag to 0 makes the layer not selectable, while setting it to 1 makes the layer selectable (equivalent of Layer.Selectable property) [sel=0] [top] top vertical offset using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "height/2" expression places the layer at the vertical middle of the control (equivalent of Layer.Top property) [top=height/2] [transparency] transparency of the layer, as a percent value or a format-expression, where "value" keyword represents the Layer.Value property, so the transparency of the layer is calculated based on the value. For instance, "100-value" expression makes the layer more transparent as the value increases, so if you set the layer's value to 0, it is fully opaque, while if you set it to 100, it is fully transparent (equivalent of Layer.Transparency property) [transparency=100-value] [value] defines the value of the layer, which can be the offset to move the layer, the angle to rotate the layer. For instance, 15 may shift the layer 15 pixels from its default position, or rotate the layer 15 degrees from its default angle, depending on how the layer is configured to interpret the value (equivalent of Layer.Value property) [value=15] [vis] shows or hides the layer. Setting the vis flag to 0 hides the layer, while setting it to 1 shows the layer (equivalent of Layer.Visible property) [vis=0] [v2a] converts value to rotation angle using a format-expression, where "value" keyword represents the Layer.Value property, so the Layer.Value property is calculated based on the value. For instance, "value/100*360" expression remaps the layer's value in a 0 - 100 range to a rotation angle in a 0 - 360 range, so if you set the layer's value to 25, it is rotated 90 degrees, and if you rotate the layer 180 degrees, its value becomes 50 (equivalent of Layer.ValueToRotateAngle property) [v2a=value/100*360] [v2x] converts value to x-offset, using a format-expression, where "value" keyword represents the Layer.Value property, so the x-offset of the layer is calculated based on the value. For instance, "(value=0)?0:48", means that if the layer's value is 0, the x-offset is 0, otherwise it is 48 pixels. This flag is useful when you want to link the layer's horizontal position to its value, such as in a switch control where the knob's position (x-offset) represents the on/off state (value) of the switch (equivalent of Layer.ValueToOffsetX property) [v2x=(value=0)?0:48] [v2y] converts value to y-offset, using a format-expression, where "value" keyword represents the Layer.Value property, so the y-offset of the layer is calculated based on the value. For instance, "(value=0)?0:48", means that if the layer's value is 0, the y-offset is 0, otherwise it is 48 pixels. This flag is useful when you want to link the layer's vertical position to its value, such as in a switch control where the knob's position (y-offset) represents the on/off state (value) of the switch (equivalent of Layer.ValueToOffsetY property) [v2y=(value=0)?0:48] [width] width of the layer using format-expression, where "width" indicates the control's width in pixels and "height" indicates the control's height in pixels. For instance, "width/4" expression sets the layer's width to a quarter of the control's width (equivalent of Layer.Width property) [width=width/4] [x] x-offset of layer. The layer's actual x-offset is the sum of left, defaultOffsetX, and offsetX, while the actual y-offset is the sum of top, defaultOffsetY, and offsetY. For instance, if you set the offsetX field to 10, the defaultOffsetX field to 5, the layer is shown with a total x-offset of 15 pixels from the position specified by the left field (equivalent of Layer.OffsetX property) [x=-32] [xCenter] defines the x-coordinate of the rotation center relative to the layer specified by the Layer.RotateCenterLayer property, using a format expression where "lwidth" or "width" represents the layer's width in pixels and "lheight" or "height" represents its height, so "lwidth/2" places the rotation center at the horizontal middle of the layer (equivalent of Layer.RotateCenterX property) [xCenter=lwidth/2] [xValid] validates, limits or spans the x-offset value of the layer, using a format-expression, where is supports "x" (x-offset value of the layer), "y" (y-offset value of the layer), "lwidth" (layer's width in pixels), "lheight" (layer's height in pixels), "width" (control's width in pixels), "height" (control's height in pixels) and "value" (can be x- or y-offset) keywords. For instance, if you set the offsetXValid field to "x MIN 0 MAX 48", the offsetX field is validated to be between 0 and 48 pixels, while "round(x/8)*8" expression spans the offsetX value to the closest multiple of 8 pixels (equivalent of Layer.OffsetXValid property) [xValid=x MIN 0 MAX 48] [y] y-offset of layer. The layer's actual y-offset is the sum of top, defaultOffsetY, and offsetY, while the actual x-offset is the sum of left, defaultOffsetX, and offsetX. For instance, if you set the offsetY field to 10, the defaultOffsetY field to 5, the layer is shown with a total y-offset of 15 pixels from the position specified by the top field (equivalent of Layer.OffsetY property) [y=-32] [yCenter] definex the y-coordinate of the rotation center relative to the layer specified by the Layer.RotateCenterLayer property, using a format expression where "lwidth" or "width" represents the layer's width in pixels and "lheight" or "height" represents its height, so "lheight/2" places the rotation center at the vertical middle of the layer (equivalent of Layer.RotateCenterY property) [yCenter=lheight/2] [yValid] validates, limits or spans the y-offset value of the layer, using a format-expression, where is supports "x" (x-offset value of the layer), "y" (y-offset value of the layer), "lwidth" (layer's width in pixels), "lheight" (layer's height in pixels), "width" (control's width in pixels), "height" (control's height in pixels) and "value" (can be x- or y-offset) keywords. For instance, if you set the offsetYValid field to "y MIN 0 MAX 48", the offsetY field is validated to be between 0 and 48 pixels, while "round(y/8)*8" expression spans the offsetY value to the closest multiple of 8 pixels (equivalent of Layer.OffsetYValid property) [yValid=y MIN 0 MAX 48]
Returns:
Returns the string-representation of the control's layers
- Type
- string
Example
"gauge_back[yCenter=lheight/2 + 78],gauge_needle[key=needle][avalid=value < 90 ? value : (value < 180 ? 90 : ( value < 270 ? 270 : value ))][a2v=value >= 270 ? (value - 270)/90*50 : (value/90)*50 + 50][v2a=value < 50 ? (270 + value/50*90) : (value - 50)/50 * 90][drag=rotate]", {string} defines a gauge control
"vista_back,vista_hour[key=hour][drag=rotate][v2a=2*360*( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)))][a2v=value/360 * 0.5],vista_min[key=min][sel=0][drag=rotate][v2a=((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360][a2v=value / 360 / 24 / 60],vista_sec[v2a=((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360][a2v=value / 360 / 24 / 60][drag=rotate][key=sec][sel=0]", {string} defines a clock control
Save
forEach(mask, callback, thisArg)
The forEach() method iterates through the control's layers that match a specified mask and calls a callback function for each layer. It can process all layers or only those that meet certain criteria (such as visible or selectable layers). While you can also iterate layers using the Item and Count methods, forEach() provides a simpler way to access each layer, allowing you to read or modify its options or execute custom code for every matched layer.
Parameters:
| Name | Type | Description |
|---|---|---|
mask |
number | Specifies the type or order of the layers to get enumerated as follows:
|
callback |
callback | Specifies the callback function to execute for each layer that matches the giving mask. The callback function takes a layer as parameter, so it should be defined as function(oLayer){...}, where oLayer is an object of Layer type. |
thisArg |
object | Specifies the value of "this" keyword within the callback function (optional). |
Example
The following example iterates all layers by index:
oRadialMenu.Layers.forEach(-1, function(oLayer, index)
{
console.log(exontrol.ToString.Quote(oLayer));
})
while the following example iterates only visible layers (by position):
oRadialMenu.Layers.forEach(1, function(oLayer, index)
{
console.log(exontrol.ToString.Quote(oLayer));
});
where oRadialMenu is an object of RadialMenu type.
forEach