Skip to content

Instantly share code, notes, and snippets.

@aklowther
Created February 19, 2013 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aklowther/4987295 to your computer and use it in GitHub Desktop.
Save aklowther/4987295 to your computer and use it in GitHub Desktop.
BB10 Cascades Button Replacement
import bb.cascades 1.0
Container {
id: topLevelContainer
property alias buttonImage: buttonImage
property alias containerToChangeButtonBackground: buttonContainer.background
property bool buttonPressed: false
leftPadding: 2.0
topPadding: 2.0
rightPadding: 2.0
bottomPadding: 2.0
Container {
//sizing left up to user
id: buttonContainer
layout: DockLayout{}
onTouch:{
if(event.isDown()){
buttonPressed = buttonPressed ? true: false;
containerToChangeButtonBackground = (buttonPressed ? Color.Blue: Color.LightGray);
}
}
ImageView {
id: buttonImage
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Left
//imageSource: whateverImageYouWantHere
}
Label {
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Right
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment