HueRing

Package: Libraries.Interface.Controls · Inherits from: Libraries.Interface.Item, Libraries.Interface.Controls.Control, Libraries.Interface.Item2D, Libraries.Language.Object, Libraries.Interface.Controls.Slider

A HueRing chooses a hue, from 0 to 360 degrees, on a ring of colors: red at the top, then yellow, green, cyan, blue and magenta going clockwise. A marker shows the chosen hue. It is a Slider, so the keys, the listeners and screen readers work as they do for any slider: Right and Up turn the hue one degree clockwise, Left and Down one degree back, Page Up and Page Down move 15 degrees, and Shift with an arrow a tenth of a degree. A click or a drag on the ring sets the hue from the angle of the pointer around the center. Screen readers hear the degrees and the name of the pure color at that hue, such as "213 degrees, dodger blue". A ColorPicker puts a SaturationBrightnessSquare inside the ring.

Example Code

use Libraries.Game.Game
use Libraries.Interface.Controls.HueRing

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        HueRing ring
        ring:SetValue(213)
        Add(ring)
    end
end

Actions

BeginPointerAt(number x, number y)

This action is called when the mouse button or a finger goes down on the ring: the ring takes the focus, and the hue jumps to the angle of the pointer.

Parameters

  • x number: Where the pointer is, across the screen.
  • y number: Where the pointer is, up the screen.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:BeginPointerAt(100, 100)

ChangeValue(number newValue, boolean isFinal)

This action changes the hue as the user does: the marker moves, and the screen reader and listeners are told.

Parameters

  • newValue number: The hue, from 0 to 360.
  • isFinal boolean: False while a drag goes on, true otherwise.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:ChangeValue(240, true)

GainedFocus(Libraries.Interface.Events.FocusEvent event)

This action is called when the ring gains the focus: its marker grows and its edge turns the focus color.

Parameters

Example

use Libraries.Interface.Controls.HueRing
use Libraries.Interface.Events.FocusEvent
HueRing ring
FocusEvent event
ring:GainedFocus(event)

GetHueAt(number x, number y)

This action returns the hue at a place on the screen: the angle of the place around the ring's center, clockwise from the top, rounded to a whole degree.

Parameters

  • x number: Where the place is, across the screen.
  • y number: Where the place is, up the screen.

Returns

number: The hue, from 0 to 360.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
number hue = ring:GetHueAt(100, 100)

GetValueText()

This action returns what a screen reader says for the hue: the degrees, then the name of the pure color at that hue, such as "213 degrees, dodger blue".

Returns

text: The value text.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:SetValue(213)
text words = ring:GetValueText()

LoadGraphics(Libraries.Interface.Layouts.LayoutProperties properties)

This action loads the views of the ring's dots and marker the first time, then updates the marker. The slider's own track and thumb are not loaded. The game engine calls this as needed, so most users won't need to call it directly.

Parameters

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:LoadGraphics(ring:GetDefaultLayoutProperties())

LostFocus(Libraries.Interface.Events.FocusEvent event)

This action is called when the ring loses the focus: its marker goes back to its usual look.

Parameters

Example

use Libraries.Interface.Controls.HueRing
use Libraries.Interface.Events.FocusEvent
HueRing ring
FocusEvent event
ring:LostFocus(event)

MovePointerAt(number x, number y)

This action is called as the pointer is dragged: the hue follows the angle of the pointer around the center.

Parameters

  • x number: Where the pointer is, across the screen.
  • y number: Where the pointer is, up the screen.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:MovePointerAt(120, 100)

SetValue(number newValue)

This action sets the hue, in degrees, as a program does: the marker moves and the screen reader is told, but listeners aren't.

Parameters

  • newValue number: The hue, from 0 to 360.

Example

use Libraries.Interface.Controls.HueRing
HueRing ring
ring:SetValue(120)

Inherited Actions

261 actions from Libraries.Interface.Controls.Control
32 actions from Libraries.Interface.Controls.Slider
61 actions from Libraries.Interface.Item
202 actions from Libraries.Interface.Item2D
3 actions from Libraries.Language.Object