Skip to content

Instantly share code, notes, and snippets.

@40
Created September 12, 2012 05:23
Show Gist options
  • Select an option

  • Save 40/3704447 to your computer and use it in GitHub Desktop.

Select an option

Save 40/3704447 to your computer and use it in GitHub Desktop.
Using Ternary Operator: Toggle Background and Container
import bb.cascades 1.0
Page {
content: Container {
preferredWidth: 768
preferredHeight: 1280
id: root
objectName: "rootContainer"
layout: DockLayout {
}
Container{
preferredWidth:768
preferredHeight: 300
id: options
background: Color.Black
translationY: -400
}
CheckBox {
id: checkBox
checked: false
scaleX: 4.0
scaleY: 4.0
translationX: 350
translationY: 700
onCheckedChanged: {
checkBox.checked == (true)? root.background = Color.Green :root.background = Color.White;
checkBox.checked == (true)? options.translationY = 0 :options.translationY = -400;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment