ClampMax

Constructor

ClampMax <id> (double max, double init_val)

Action

Keeps an input value below the specified maximum value.

Predefined children

  • DoubleProperty: max, input, result.

Example


use core
use base
use display
use gui

_main_
Component root {
  Frame f ("myFrame", 0, 0, 500, 500)
  FillColor _ (0, 0, 0)
  Text unbounded (50, 50, "")
  Text bounded (50, 150, "")
  ClampMax max_x (500, 0)
  f.width => max_x.max
  f.move.x => max_x.input, unbounded.text
  max_x.result => bounded.text
}