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

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 196
Registered: ‎12-14-2009
My Device: Not Specified
Accepted Solution

I can't get a simple button with BBUI.js

Got this in my head:

 

<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi" />
<link  rel="stylesheet" type="text/css" href="bbui-0.9.2.css"></link>
        <script type="text/javascript" src="bbui-0.9.2.js"></script>
<script language="javascript" type="text/javascript">
bb.init();

I package the css and js with my app.

 

I got this in the html body:

 

<div data-bb-type="button" onclick="alert('click');" data-bb-style="stretch" id="plain">My Button</div>

 Yet when I test the app it just shows the text My Button with no button around it to interact with. 

What am I doing wrong or not including?

 

Developer
Posts: 466
Registered: ‎04-11-2012
My Device: Bold 9900
My Carrier: Rogers

Re: I can't get a simple button with BBUI.js

try

 

 

<INPUT TYPE="button" class="bb-bb10-button-dark" Value="My Button" onclick="alert('click')" >

Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
Find me online via twitter, or on the techfruits.com webpage. Please hit the like button below if what I said helped!
Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: I can't get a simple button with BBUI.js

I believe the step you are missing is to load your screen.

index.html

<html> 
<head>
<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="bbui-0.9.2.css"></link>
<script type="text/javascript" src="bbui-0.9.2.js"></script>
<script type="text/javascript">
bb.init();
</script>
</head>
<body onload="bb.pushScreen('menu.html', 'menu');">
</body>
</html>

menu.html (from the above example, this is a separate .html file, no <html> or <body> tags needed):

<div data-bb-type="screen" data-bb-title="Test App" data-bb-effect="fade">
<div data-bb-type="button" onclick="alert('click');" id="plain">My Button</div>
</div>

Let me know if that doesn't work.

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Developer
Posts: 196
Registered: ‎12-14-2009
My Device: Not Specified

Re: I can't get a simple button with BBUI.js

Thanks. But I tried that. I get the button but it is above the other screen. I want the buttons on the screen that I have textboxs with etc.

 

 

Developer
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900
My Carrier: Rogers

Re: I can't get a simple button with BBUI.js

All your content for each screen should be on the same html page. So if you have more content that goes with the button it should all be in menuh.tml (in my msg above), or whatever you called it.

Your index.html should not have much more than the example I gave, everything else should be in the screen pages when using bbUI.

If you still have trouble if you could post your full pages it would be much easier to help you out.
--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful