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
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Display Keep-Alive in Cascades

Thanks Peter. For some reason (probably because I was up too late last night) it didn't get to me that this line was just Javascript &colon:smileywink:

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
TheMarco
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: Display Keep-Alive in Cascades

Ok it works like a charm Peter. Thanks a bunch!

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Please use plain text.
Developer
smiley
Posts: 1,454
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Display Keep-Alive in Cascades


peter9477 wrote:

Complete QML:

import bb.cascades 1.0

Page {
    Container {
        Label {
            id: label
            text: "KeepAwake is " + (Application.mainWindow.screenIdleMode ? "ON" : "OFF")
        }

        ToggleButton {
            onCheckedChanged: Application.mainWindow.screenIdleMode = checked ? 1 : 0;
        }
    }
}

 


Peter9477: How would I do this outside of qml in my C++ file?

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Display Keep-Alive in Cascades

I would expect something like Application::instance()->mainWindow->setScreenIdleMode(...stuff here...) to work. Check the docs at https://developer.blackberry.com/cascades/reference/bb__cascades__window.html#setscreenidlemode

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.