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     
        style.color = SCDGraphicsRGB(red:39,blue:100,green:130)
        
    }
}