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
Contributor
lichienmine
Posts: 36
Registered: ‎08-15-2013
My Device: Blackberry 10
My Carrier: XL
Accepted Solution

Update SystemProgressDialog automatically in QML

I need some help, i want to update my SystemProgressDialog progress every second for 1 minutes. i have try but the progress is not update. here's my code :

Container {
	Button {
		text : "Start"
		onClicked : {
			myProgress.show()
			myTimer.start()
		}
	}
	attachedObject : [
		SystemProgressDialog {
            id : myProgress
            title: ""
            body: ""
            progress: 0
            emoticonsEnabled: true
            state : SystemUiProgressState.Active
        },
        QTimer {
            id: myTimer
            interval:  1000
            onTimeout: {
				if (myProgress.progress < 100 ){
					//I have try this one too myProgress.progress = myProgress.progres + (100/60)
					myProgress.progressChanged(myProgress.progres + (100/60))
					timer.start()
				}
                
            }
        }
	]
}

 

Please use plain text.
Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Update SystemProgressDialog automatically in QML

[ Edited ]

You need to start as first Timer

onClicked:{
    myTimer.start()
    myProgress.show() 
}

 And also Timer will keep repeating until you stop it. So call myTimer.start() in onTimeout signal is bad...

 

Try this:

Page {
    Button {
        text : "Start"
        onClicked : {
            myTimer.start()
            myProgress.show()
        
        }
    }
    attachedObjects : [
        SystemProgressDialog {
            id : myProgress
            title: "Title"
            onFinished: {
                if (result == SystemUiResult.ConfirmButtonSelection){
                    console.debug("OK clicked")
                    myTimer.stop()
                }
            }
        },
        MyTimer {
            id: myTimer
            interval:  1000
            onTimeout: {
                if (myProgress.progress == 100 ){
myProgress.cancel() stop() } myProgress.progress += 100/60 console.debug("CurrentProgress: ".concat(myProgress.progress)) myProgress.update() } } ] }

 If you use Cascades API 1.2 then you can try set autoUpdateEnabled to tru insted of using myProgress.update()



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Please use plain text.
Contributor
lichienmine
Posts: 36
Registered: ‎08-15-2013
My Device: Blackberry 10
My Carrier: XL

Re: Update SystemProgressDialog automatically in QML

thanks, it's working :smileyhappy:
Please use plain text.
Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Update SystemProgressDialog automatically in QML

You're welcome 



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Please use plain text.