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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C
My Carrier: Rogers
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
Posts: 209
Registered: ‎05-08-2012
My Device: PlayBook 64 Gb and Z10 LE
My Carrier: Vodafone

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 Smiley Wink
Developer
Posts: 304
Registered: ‎08-14-2012
My Device: PlayBook, Z10, Dev C
My Carrier: Rogers

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