Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 84
Registered: ‎04-22-2013
My Device: BB 10 Dev
My Carrier: Simulator

Unable to run Picker page

[ Edited ]

Hi all,

I just started to develop an app on bb10 simulator in qml using navigation pane.

I have the main menu page which used a button onclick to navigate to the following page but unable to click in.

I actually follow the example from here including those images putting at the right folder https://developer.blackberry.com/cascades/documentation/ui/pickers/tutorial_create_ui_qml.html but still unable to get this run.

 

Can anyone help to figure out what's going wrong. 

Thanks in advance.

 

import bb.cascades 1.0
import "Common"

Page {
    id: smb_roller
    Container {
        property string myValue: "Aries - Rat"
        Container {
            layout: DockLayout {

            }
            opacity: 1.0
            visible: true
            horizontalAlignment: HorizontalAlignment.Center
            background: Color.Transparent
            leftPadding: 0.0
            ImageView {
                imageSource: "asset:///images/header.jpg"
                preferredHeight: 150.0
                opacity: 0.9

            }
            Container {
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Left
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }

                HomeButton {
                    image: "asset:///images/home.png"
                    text: "Home"

                    onTouch: {
                        nav.pop();
                    }
                }

                Label {
                    text: "Testing"
                    preferredHeight: 100.0
                    verticalAlignment: VerticalAlignment.Center
                    horizontalAlignment: HorizontalAlignment.Center
                    textStyle {
                        base: SystemDefaults.TextStyles.MediumText
                        color: Color.White
                    }
                }

                HomeButton {
                    image: "asset:///images/logout.png"
                    text: "Logout"

                    onTouch: {
                        nav.pop();
                    }
                }
            }

        }
        Label {
            id: zooey
            text: "Zodiac picker"
        } // end of Label
        Picker {
            id: zodiac
            property string myValue: "Aries - Rat"
            title: "Zodiac"
            description: zodiac.myValue
            dataModel: XmlDataModel {
                source: "zodiacvalues.xml"
            } // end of dataModel
            pickerItemComponents: [
                PickerItemComponent {
                    type: "itemmonth"
                    content: Container {
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
                        } // end of StackLayout
                        ImageView {
                            imageSource: pickerItemData.filename
                        } // end of ImageView
                        Label {
                            text: pickerItemData.displayname
                        } // end of Label
                    } // end of Container
                }, // end of PickerItemComponent
                PickerItemComponent {
                    type: "itemyear"
                    content: Container {
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
                        } // end of StackLayout
                        ImageView {
                            imageSource: pickerItemData.filename
                        } // end of ImageView
                        Label {
                            text: pickerItemData.displayname
                        } // end of Label
                    } // end of Container
                } // end of PickerItemComponent
            ] // end of pickerItemComponents
            onSelectedValueChanged: {
                var monthName
                switch (zodiac.selectedIndex(0)) {
                    case 0:
                        monthName = "Aries";
                        break;
                    case 1:
                        monthName = "Taurus";
                        break;
                    case 2:
                        monthName = "Gemini";
                        break;
                    case 3:
                        monthName = "Cancer";
                        break;
                    case 4:
                        monthName = "Leo";
                        break;
                    case 5:
                        monthName = "Virgo";
                        break;
                    case 6:
                        monthName = "Libra";
                        break;
                    case 7:
                        monthName = "Scorpio";
                        break;
                    case 8:
                        monthName = "Sagittarius";
                        break;
                    case 9:
                        monthName = "Capricorn";
                        break;
                    case 10:
                        monthName = "Aquarius";
                        break;
                    case 11:
                        monthName = "Pisces";
                        break;
                } // end of switch
                var yearName
                switch (zodiac.selectedIndex(1)) {
                    case 0:
                        yearName = "Rat";
                        break;
                    case 1:
                        yearName = "Ox";
                        break;
                    case 2:
                        yearName = "Tiger";
                        break;
                    case 3:
                        yearName = "Rabbit";
                        break;
                    case 4:
                        yearName = "Dragon";
                        break;
                    case 5:
                        yearName = "Snake";
                        break;
                    case 6:
                        yearName = "Horse";
                        break;
                    case 7:
                        yearName = "Goat";
                        break;
                    case 8:
                        yearName = "Monkey";
                        break;
                    case 9:
                        yearName = "Rooster";
                        break;
                    case 10:
                        yearName = "Dog";
                        break;
                    case 11:
                        yearName = "Pig";
                        break;
                } // end of switch
                zodiac.myValue = monthName + " - " + yearName
            } // end of onSelectedValueChanged
        } // end of Picker
        Label {
            id: zodiacLabel
            text: zodiac.myValue
        } // end of Label
    }
    
}// end of Page

 with the zodiacvalues.xml

 

<model>
  <column loop="true">
    <itemmonth filename="asset:///images/aries.jpg" displayname="Aries" />
    <itemmonth filename="asset:///images/taurus.jpg" displayname="Taurus" />
    <itemmonth filename="asset:///images/gemini.jpg" displayname="Gemini" />
    <itemmonth filename="asset:///images/cancer.jpg" displayname="Cancer" />
    <itemmonth filename="asset:///images/leo.jpg" displayname="Leo" />
    <itemmonth filename="asset:///images/virgo.jpg" displayname="Virgo" />
    <itemmonth filename="asset:///images/libra.jpg" displayname="Libra" />
    <itemmonth filename="asset:///images/scorpio.jpg" displayname="Scorpio" />
    <itemmonth filename="asset:///images/sagittarius.jpg"
        displayname="Sagittarius" />
    <itemmonth filename="asset:///images/capricorn.jpg"
        displayname="Capricorn" />
    <itemmonth filename="asset:///images/aquarius.jpg"
        displayname="Aquarius" />
    <itemmonth filename="asset:///images/pisces.jpg" displayname="Pisces" />
  </column>
  <column loop="true">
    <itemyear filename="asset:///images/rat.jpg" displayname="Rat" />
    <itemyear filename="asset:///images/ox.jpg" displayname="Ox" />
    <itemyear filename="asset:///images/tiger.jpg" displayname="Tiger" />
    <itemyear filename="asset:///images/rabbit.jpg" displayname="Rabbit" />
    <itemyear filename="asset:///images/dragon.jpg" displayname="Dragon" />
    <itemyear filename="asset:///images/snake.jpg" displayname="Snake" />
    <itemyear filename="asset:///images/horse.jpg" displayname="Horse" />
    <itemyear filename="asset:///images/goat.jpg" displayname="Goat" />
    <itemyear filename="asset:///images/monkey.jpg" displayname="Monkey" />
    <itemyear filename="asset:///images/rooster.jpg" displayname="Rooster" />
    <itemyear filename="asset:///images/dog.jpg" displayname="Dog" />
    <itemyear filename="asset:///images/pig.jpg" displayname="Pig" />
  </column>
</model>

 

Below is the error log i got. Any idea?

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:21:43.278
!MESSAGE 
!STACK 0
org.eclipse.jface.text.BadLocationException
	at org.eclipse.jface.text.TreeLineTracker.fail(TreeLineTracker.java:1055)
	at org.eclipse.jface.text.TreeLineTracker.lineByOffset(TreeLineTracker.java:267)
	at org.eclipse.jface.text.TreeLineTracker.getLineNumberOfOffset(TreeLineTracker.java:1137)
	at org.eclipse.jface.text.AbstractLineTracker.getLineNumberOfOffset(AbstractLineTracker.java:161)
	at org.eclipse.jface.text.AbstractDocument.getLineOfOffset(AbstractDocument.java:915)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getLineOfOffset(SynchronizableDocument.java:397)
	at com.rim.tad.tools.qml.core.internal.editor.marker.QMLProblem.<init>(QMLProblem.java:44)
	at com.rim.tad.tools.qml.core.internal.editor.QMLErrorResolver.resolve(QMLErrorResolver.java:39)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy$1.run(QMLEditorReconcilingStrategy.java:95)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$5.call(MasterModel.java:136)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$5.call(MasterModel.java:1)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.readAccess(TransactionModel.java:101)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.readInSyncAccess(MasterModel.java:133)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy.doReconcile(QMLEditorReconcilingStrategy.java:90)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy.reconcile(QMLEditorReconcilingStrategy.java:77)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconciler.modelChanged(QMLEditorReconciler.java:32)
	at com.rim.tad.tools.qml.core.internal.model.DirectModelNotifier$1.run(DirectModelNotifier.java:27)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$4.call(MasterModel.java:120)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$4.call(MasterModel.java:1)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.readAccess(TransactionModel.java:89)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.readAccess(MasterModel.java:117)
	at com.rim.tad.tools.qml.core.internal.model.DirectModelNotifier.fireEvent(DirectModelNotifier.java:22)
	at com.rim.tad.tools.qml.core.internal.model.ListenerModel.fireChanged(ListenerModel.java:129)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.fireChanged(MasterModel.java:194)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.update(TransactionModel.java:152)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.update(MasterModel.java:155)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditor$2.invokeUpdateFromLastTextSnapshot(QMLEditor.java:278)
	at com.rim.tad.tools.qml.core.internal.editor.QMLModelUpdater$ValidationJob.updateNow(QMLModelUpdater.java:150)
	at com.rim.tad.tools.qml.core.internal.editor.QMLModelUpdater$ValidationJob.run(QMLModelUpdater.java:139)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:21:43.280
!MESSAGE 
!STACK 0
org.eclipse.jface.text.BadLocationException
	at org.eclipse.jface.text.AbstractDocument.addPosition(AbstractDocument.java:355)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.addPosition(SynchronizableDocument.java:236)
	at org.eclipse.jface.text.AbstractDocument.addPosition(AbstractDocument.java:376)
	at org.eclipse.jface.text.source.AnnotationModel.addPosition(AnnotationModel.java:478)
	at org.eclipse.jface.text.source.AnnotationModel.addAnnotation(AnnotationModel.java:440)
	at com.rim.tad.tools.qml.core.internal.model.QMLDocumentProvider$QMLAnnotationModel.addAnnotation(QMLDocumentProvider.java:879)
	at com.rim.tad.tools.qml.core.internal.model.QMLDocumentProvider$QMLAnnotationModel.reportProblems(QMLDocumentProvider.java:742)
	at com.rim.tad.tools.qml.core.internal.model.QMLDocumentProvider$QMLAnnotationModel.internalEndReporting(QMLDocumentProvider.java:697)
	at com.rim.tad.tools.qml.core.internal.model.QMLDocumentProvider$QMLAnnotationModel.endReporting(QMLDocumentProvider.java:676)
	at com.rim.tad.tools.qml.core.internal.editor.QMLErrorResolver.reportProblems(QMLErrorResolver.java:71)
	at com.rim.tad.tools.qml.core.internal.editor.QMLErrorResolver.resolve(QMLErrorResolver.java:50)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy$1.run(QMLEditorReconcilingStrategy.java:95)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$5.call(MasterModel.java:136)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$5.call(MasterModel.java:1)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.readAccess(TransactionModel.java:101)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.readInSyncAccess(MasterModel.java:133)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy.doReconcile(QMLEditorReconcilingStrategy.java:90)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconcilingStrategy.reconcile(QMLEditorReconcilingStrategy.java:77)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditorReconciler.modelChanged(QMLEditorReconciler.java:32)
	at com.rim.tad.tools.qml.core.internal.model.DirectModelNotifier$1.run(DirectModelNotifier.java:27)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$4.call(MasterModel.java:120)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel$4.call(MasterModel.java:1)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.readAccess(TransactionModel.java:89)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.readAccess(MasterModel.java:117)
	at com.rim.tad.tools.qml.core.internal.model.DirectModelNotifier.fireEvent(DirectModelNotifier.java:22)
	at com.rim.tad.tools.qml.core.internal.model.ListenerModel.fireChanged(ListenerModel.java:129)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.fireChanged(MasterModel.java:194)
	at com.rim.tad.tools.qml.core.internal.model.TransactionModel.update(TransactionModel.java:152)
	at com.rim.tad.tools.qml.core.internal.model.MasterModel.update(MasterModel.java:155)
	at com.rim.tad.tools.qml.core.internal.editor.QMLEditor$2.invokeUpdateFromLastTextSnapshot(QMLEditor.java:278)
	at com.rim.tad.tools.qml.core.internal.editor.QMLModelUpdater$ValidationJob.updateNow(QMLModelUpdater.java:150)
	at com.rim.tad.tools.qml.core.internal.editor.QMLModelUpdater$ValidationJob.run(QMLModelUpdater.java:139)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.276
!MESSAGE QML type not found: BaseObject

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.277
!MESSAGE QML type not found: BaseObject

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.279
!MESSAGE QML type not found: BaseObject

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.280
!MESSAGE QML type not found: BaseObject

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.431
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.431
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.432
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.433
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.434
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.core 2 0 2013-04-23 11:25:35.435
!MESSAGE QML type not found: long

!ENTRY com.rim.tad.tools.qml.simulator 1 0 2013-04-23 11:26:07.719
!MESSAGE QML Preview compatibility check log.