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
Regular Contributor
Asmooh
Posts: 77
Registered: ‎10-27-2010
My Device: Passport SQW100-1
Accepted Solution

Titlebar cancel button

[ Edited ]

I checked all bbui guides but they all refer back to a back button.

I have a back button under in the actionbar, which is good it should be there.

I am looking for a titlebar cancel button, when i press this button it should ignore anything and just go back to the first screen (in my case is this home.html).

 

 

Example:

 

<div id="camerasavebar" data-bb-type="title" data-bb-caption="Save picture" data-bb-action-caption="Save" data-bb-img=""  data-bb-back-caption="Cancel" onactionclick="doSavealluploads()"></div>

 

This: data-bb-back-caption="Cancel" will always return one page back, which should not be because there is where i have a back button for.

I already have the onactionclick in use so that one i can't use anymore.

 

 

 

 

Oh i had an other question, is there a way to detect if the app is being closed or put in active frame?

 

 

And how can i make a link (clickable) that goes directly to my BBM channel? (app is already connected to bbm)

 

 

BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Titlebar cancel button

Within BBUI, the upper-left Back button for Title Bars is not customizable. You *might* be able to override the default click behaviour by setting an onclick function, or by using Web Inspector to figure out the element ID (after BBUI does its processing of the page), and then setting a click handler on that item directly (i.e. within the ondomready function), but the framework itself isn't set up to do this, you'll have to hack around a bit. BBUI aims to follow UI guidelines, and the guideilne for the Cancel/Back button in the top left corner is to return to the previous page (just like the Back button on the Action Bar.)

 

 

You can use the windowstatechanged API to determine state changes:

https://developer.blackberry.com/html5/apis/beta/blackberry_app_windowstatechanged.html

 

However, if the application is closing, it won't wait for JavaScript to finish whatever it is executing. So if your, for example, save data on minimize, and the user then closes the app before the saving is complete, you may have half-saved data.

 

 

You can invoke your BBM channel using the Invocation Framework as outlined here:

https://developer.blackberry.com/html5/documentation/beta/bbm.html

 

For this, you're actually executing JavaScript, so you'll need to associate a click handler with the link, and trigger the Invocation code for your BBM channel.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Asmooh
Posts: 77
Registered: ‎10-27-2010
My Device: Passport SQW100-1

Re: Titlebar cancel button

I found the BBM channel API en documentation already but i don't really get it.

I added the following:

// bbmc:
bbmc: {

// vendor page
channel: function(id) {
blackberry.invoke.invoke({
target: 'sys.bbm.channels.card.previewer',
action: 'bb.action.OPENBBMCHANNEL',
uri: 'bbmc:' + id
},

// success
function() {},

// error
function() {});
}
},


should i just call onclick="bbmc(mychannel)"; ?

About the app close, it will send only a few bytes (you are offline or online) so not much data
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Titlebar cancel button

Based on that there, it looks like you would need to call:
bbmc.channel(SomeID);

Where SomeID is the BBM Channels ID you want to launch.


For the app close, chances are the minimized event can trigger and send it off in time (unless you have a really quick user or very slow connection - if it's going externally.) :-)

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Asmooh
Posts: 77
Registered: ‎10-27-2010
My Device: Passport SQW100-1

Re: Titlebar cancel button

Hehe thanks, i changed it to when minimized it's: idle, when closing (invisible as state) it will be offline, seems to work for now.

Otherwise the user will be idle all the time, at least better than online :smileyhappy: