SCADE

Set colors

Allow a short tutorial on changing the color, of for instance the background of your control. The code itself is a little wordy, but we are improving this shortly.

Setting background color programmatically

The key is to use the getStyle method and define the style type:

import ScadeKit

class MainPageAdapter: SCDLatticePageAdapter {

	// page adapter initialization
	override func load(_ path: String) {		
		super.load(path)
		
		// too wordy but it works. Refining the API soon
		let tmpBackground = SCDWidgetsBackgroundStyle()
		let style = self.page!.getStyle(tmpBackground.eClass()) as! SCDWidgetsBackgroundStyle
		style.type = SCDWidgetsBackgroundType.color
		
		let green = SCDGraphicsRGB()
		green.red = 39
		green.blue = 100 
		green.green = 130
		
		style.color = green
		
	}
}

Set colors