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

VariableDescriptionComment
onSlideArray to append slide events.
positionCurrent position within the rangeType Int
minValueMinimum rangeType Int. Default 1
maxValueMaximum rangeType 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

VariableDescriptionComment
oldValuevalue before the slide
newValuevalue 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"))
],

VariableDescription
bullet
backgroundLine
onSlidesliderLine.onSlide { event in
print(event.newValue, event.oldValue)
}