(Blackberry 10) QML – Membuat Button dan Toast Show Message

Salam semangat….

Sudah lama ane tidak share atau posting di blog ane, karena setelah ane merelease buku dan project di bulan suci ramadhan 1434 H, sehingga ane lebih memiliki aktifitas lain yang digunakan untuk merayakan hari kemenangan(LEBARAN), hari lebaran ane KO banget dah gan, dari hari pertama dan kedua ane silaturahmi di tempat sanak dan keluarga ane, dan untuk hari ke 3 hingga hari 7 ane silaturahmi tempat temen ane, jadi tidak ada sempet-sempet untuk melakukan aktifitas di depan laptop.

Blackberry 10, merupakan system operasi berutan RIM yang dikembangkan untuk smartphone BB yang terbaru, menurut ane untuk teknologi di OS ini sama dengan os kompetitornya, sama sama cerdas dan luar biasa, sehingga ane bermaksud untuk memperdalam OS ini untuk di kembangkan ke system yang ane buat.

QML (Qt Meta Language or Qt Modeling Language[2]) is a JavaScript-based, declarative language for designing user interface–centric applications. It is part of Qt Quick, the UI creation kit developed by Nokia within the Qt framework. QML is mainly used for mobile applications where touch input, fluid animations (60 FPS) and user experience are crucial. QML documents describe an object tree of elements. QML elements[3] shipped with Qt are a sophisticated set of building blocks, graphical (e.g., rectangle, image) and behavioral (e.g., state, transition, animation). These elements can be combined to build components ranging in complexity from simple buttons and sliders, to complete internet-enabled programs.
QML elements can be augmented by standard JavaScript both inline and via included .js files. Elements can also be seamlessly integrated and extended by C++ components using the Qt framework.
QML is the language; the runtime is called Qt Declarative.()http://en.wikipedia.org/wiki/QML.

Create Project Blackberry Project

Buka file main.xml dan tuliskan scrip di bawah ini

 // Default empty project template
import bb.cascades 1.0
import bb.system 1.0//import system

// creates one page with a label
Page {
    Container {
        layout: DockLayout {}
       
        Label {
            text: qsTr("Hello World")
            textStyle.base: SystemDefaults.TextStyles.BigText
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
        }
        TextField {

        }
       
            Button {
                text: "First time?"
                attachedObjects: [
                    SystemToast {
                        id: myQmlToast//toast cancle 
                        body: "So long! Thanks for coming, see you next time!"
                        onFinished: {
                            Application.quit();
                        }
                    },
                    SystemDialog {
                        id: myQmlDialog//toast aktifitas ya/tidak
                        title: "Friendly Warning"
                        body: "Kakel can be habit-forming... "
                        onFinished: {
                            if (myQmlDialog.result == SystemUiResult.CancelButtonSelection) myQmlToast.show();
                        }
                    }
                ]
                onClicked: {
                    myQmlDialog.show()//memanggil method myQmDialog
                }
            }            // button

        }
    }

8-14-2013 7-35-50 AM

8-14-2013 7-36-11 AM

Referensi :
https://developer.blackberry.com/cascades/documentation/ui/dialogs_toasts/toasts.html#pat1362009427192

Advertisements

Published by

jarcode

hello I am jarcode

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s