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
bbquincar
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C
Accepted Solution

Sample code with onClick and website as one button launcher

Hi I'm new to developing and just putting things together piece by piece. Im looking for a sample code for a button on screen with onClick that will send me a to specific web page URL

 

I seem to keep doing it wrong and not sure if I'm doing it the correct way.

 

I know how to do each feature separate but not together

BlackBerry 10 game reviews for the unknown, small and indie developers. Little games with big dreams. VeryBerryGames.com | Follow @VeryBerryGames | TwoCasualCoders.com | never casual on quality
Developer
Zukka
Posts: 201
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE

Re: Sample code with onClick and website as one button launcher

HI !!

U check in the documentation page?

 

https://developer.blackberry.com/cascades/reference/bb__cascades__button.html

 

I think U use the signal generate when the button is clicked and open a WebView

_______________________________________________

If U like my post click on LIKE :smileywink:
Developer
bbquincar
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C

Re: Sample code with onClick and website as one button launcher

[ Edited ]

ok i understand how to do that stuff. im really new and programming so trying to add webView onClick seems hard. Im at work not but tonight ill paste what my code looks like and maybe someone can see what im doing wrong.

 

Page {
    content: Container {
        layout: StackLayout {
            layoutDirection: LayoutDirection.TopToBottom
        }
        scrollMode: ScrollMode.Both
        WebView {
            url: "http://www.google.com"
        }
    }
}

 

Id like to add onClick to this now and make it a button on a screen.

 

******** UPDATE Solved********

main.qml

import bb.cascades 1.0

NavigationPane {
    id: navigationPane
    Page {
        Button {
            id: buttonID
            onClicked: {
                navigationPane.deprecatedPushQmlByString(“blog.qml”);
            }
            text: “Go To My Blog”
        }
    }
}

 

blog.qml

import bb.cascades 1.0

Page {
    ScrollView {
        Container {
            background: Color.create (“#f8f8f8”)
            layout: StackLayout {
                layoutDirection: LayoutDirection.TopToBottom
            }
            WebView {
                url: “http://www.bbcascadescode.tumblr.com/
            }
        }
    }
}

 

Soultion By: http://bbcascadescode.tumblr.com/

BlackBerry 10 game reviews for the unknown, small and indie developers. Little games with big dreams. VeryBerryGames.com | Follow @VeryBerryGames | TwoCasualCoders.com | never casual on quality