Created
September 12, 2012 05:23
-
-
Save 40/3704447 to your computer and use it in GitHub Desktop.
Using Ternary Operator: Toggle Background and Container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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