ColorWellChangedEvent

Package: Libraries.Interface.Events · Inherits from: Libraries.Language.Object

The ColorWellChangedEvent says a ColorWell's color was changed by the user, with the color before and after the change. While the picker is open, each change is shown in the well at once and sent as an event that is not final. When the user presses OK, one final event is sent, whose old color is the color before the picker opened. When the user cancels after changing the color, one final event puts the old color back. A listener can show cheap changes while the picker is open and do costly work, such as saving an undo step, only on the final event.

Example Code

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Interface.Events.ColorWellListener

class FogColorListener is ColorWellListener
    action ColorWellChanged(ColorWellChangedEvent event)
        if event:IsFinal()
            output "The fog is now " + event:GetColorWell():GetColorText()
        end
    end
end

Actions

GetColorWell()

This action returns the color well whose color changed.

Returns

Libraries.Interface.Controls.ColorWell: The color well.

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Interface.Controls.ColorWell
ColorWellChangedEvent event
ColorWell well = event:GetColorWell()

GetNewColor()

This action returns the color after the change.

Returns

Libraries.Game.Graphics.Color: The new color.

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Game.Graphics.Color
ColorWellChangedEvent event
Color after = event:GetNewColor()

GetOldColor()

This action returns the color before the change. For a final event when the picker closes with OK, this is the color before the picker opened.

Returns

Libraries.Game.Graphics.Color: The old color.

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Game.Graphics.Color
ColorWellChangedEvent event
Color before = event:GetOldColor()

IsFinal()

This action returns true if the change is finished: the picker closed with OK, a cancel put the old color back, or a program set the color. It returns false while the picker is still open.

Returns

boolean: True if the change is finished.

Example

use Libraries.Interface.Events.ColorWellChangedEvent
ColorWellChangedEvent event
boolean done = event:IsFinal()

SetColorWell(Libraries.Interface.Controls.ColorWell colorWell)

This action sets the color well whose color changed.

Parameters

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Interface.Controls.ColorWell
ColorWell well
ColorWellChangedEvent event
event:SetColorWell(well)

SetFinal(boolean isFinal)

This action sets whether the change is finished.

Parameters

  • isFinal boolean: True if the change is finished.

Example

use Libraries.Interface.Events.ColorWellChangedEvent
ColorWellChangedEvent event
event:SetFinal(true)

SetNewColor(Libraries.Game.Graphics.Color color)

This action sets the color after the change.

Parameters

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Game.Graphics.Color
Color color
ColorWellChangedEvent event
event:SetNewColor(color:Blue())

SetOldColor(Libraries.Game.Graphics.Color color)

This action sets the color before the change.

Parameters

Example

use Libraries.Interface.Events.ColorWellChangedEvent
use Libraries.Game.Graphics.Color
Color color
ColorWellChangedEvent event
event:SetOldColor(color:Red())

Inherited Actions

3 actions from Libraries.Language.Object