12-13-2012 11:51 PM - edited 12-13-2012 11:53 PM
Hi all,
I'm trying to get a segmentedControl to toggle between the visiblity of two separate containers driverBioText and driverStatsList. I'll paste my code, and maybe someone can point out what I am doing wrong? I'm still a programming noob.
------
SegmentedControl {
id: segmentedDrivers
Option {
id: biography
text: "Biography"
value: "biography"
selected: true
}
Option {
id: statistics
text: "Statistics"
value: "statistics"
}
onSelectedIndexChanged: {
var value = segmentedDrivers.selectedValue()
console.debug("Selected value: " + value);
if(value = "biography") driverBioText.visible = true()
else driverStatsList.visible = true()
}
}
Container {
ScrollView {
TextArea {
id: driverBioText
rightPadding: 30.0
leftPadding: 30.0
visible: false
editable: false
topMargin: 10.0
}
}
}
Container {
ScrollView {
TextArea {
id: driverStatsList
rightPadding: 30.0
leftPadding: 30.0
visible: false
editable: false
topMargin: 10.0
text: "driver stats"
}
}
}
-----
Thanks!
Solved! Go to Solution.
12-14-2012 01:00 AM
12-14-2012 01:08 AM
Thank you.
You're referring to where I have
if(value = "biography") driverBioText.visible = true()
else driverStatsList.visible = true()
right?
I removed the ()'s after true on both and it didn't seem to fix it though.
12-14-2012 01:15 AM
12-14-2012 01:23 AM
I see. I have tried different variations like you mentioned. I even tried attaching ids to the individual Containers and referring to them instead of the TextArea ids themselves under onSelectedIndexChanged.
The other method you mentioned didn't work because I can't list two separate TextArea components under one ScrollView. I get the error
The default property for the component 'ScrollView' does not accept several objects.
12-14-2012 01:25 AM
12-14-2012 01:29 AM - edited 12-14-2012 01:31 AM
Yeah, that won't work unless I also use two different ScrollViews. I can't do one Container, then one ScrollView, with two separate TextAreas. I get an error.
So instead I did one Container, then two ScrollViews inside of that, each with the corresponding TextAreas.
Does that make sense?
Edit: Unless you meant do one single ScrollView with the Container nested in it, containing both TextAreas. That works. But again my problem isn't solved. ![]()
12-14-2012 01:35 AM
12-14-2012 01:49 AM
It still didn't seem to do the trick.
----
// Tabbed Pane project template
import bb.cascades 1.0
Page {
property alias driverPhoto : driverPhotoURL.imageSource
property alias driverBio : driverBioText.text
property alias driverName : driverListInfo.title
property alias driverTeam : driverListInfo.description
property alias driverNumber : driverListInfo.status
property alias driverFlag : driverListInfo.imageSource
Container {
ImageView {
id: driverPhotoURL
scalingMethod: ScalingMethod.AspectFill
minHeight: 481.0
}
StandardListItem {
id: driverListInfo
}
SegmentedControl {
id: segmentedDrivers
Option {
id: biography
text: "Biography"
value: "biography"
selected: true
}
Option {
id: statistics
text: "Statistics"
value: "statistics"
}
onSelectedIndexChanged: {
var value = segmentedDrivers.selectedValue()
console.debug("Selected value: " + value);
if(value == "biography") driverBioText.visible = true
else driverStatsList.visible = true
}
}
ScrollView {
Container {
id: textContainer
TextArea {
id: driverBioText
rightPadding: 30.0
leftPadding: 30.0
editable: false
topMargin: 10.0
visible: false
}
TextArea {
id: driverStatsList
rightPadding: 30.0
leftPadding: 30.0
editable: false
topMargin: 10.0
text: "Driver Stats"
visible: false
}
}
}
}
}
--
That's the whole code for this QML. Neither of the text boxes seem to show. Maybe the whole code will give you a better idea? I appreciate the help.
12-14-2012 02:40 AM