Sliderline control

Slider control to select value on a scale

📘

Sourcecode

Please see the UgSliderControlDemo project for the source code created in this chapter. See Installing examples for information on how to download the examples.

Introduction

The Sliderline control is a range control that allows you to set a range. We will rename sliderline to slider control in a later release

Sliderline Properties

Variable

Description

Comment

onSlide

Array to append slide events.

position

Current position within the range

Type Int

minValue

Minimum range

Type Int. Default 1

maxValue

Maximum range

Type Int. Default 100

Creating simple sliderline control

  1. Create new page
  2. Drag and drop sliderline control
  3. Name the control sliderLine1
  4. Set the percentage variable from within the event. Use the ev.newValue and cast it to String
import ScadeKit
  
class MainPageAdapter: SCDLatticePageAdapter {
  
  // page adapter initialization
  override func load(_ path: String) {
    super.load(path)
    
    self.sliderLine1.onSlide.append(SCDWidgetsSliderLineEventHandler {
        ev in print(ev!.newValue,ev!.oldValue)
    })
        
  }
}

SCDWidgetsSlideLineEvent

Variable

Description

Comment

oldValue

value before the slide

newValue

value after the slide

touchState

.began
.changed
.ended

SliderLine extension

For using extension:

Add library:
import ScadeUI

Add dependencies:
dependencies: [
.package(name: "ScadeExtensions", url: "https://github.com/scade-platform/ScadeExtensions.git", .branch("main"))
],

Variable

Description

bullet

backgroundLine

onSlide

sliderLine.onSlide { event in
print(event.newValue, event.oldValue)
}