If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Contributor
cellinova
Posts: 11
Registered: ‎10-05-2012
My Device: Blackberry 10 Dev Alpha Device
My Carrier: Rogers

OrientationHandler does not support onOrientationAboutToChange signal

I'm trying to capture the event when the orientation changes.  But it seems the onOrientationAboutToChange signal does not exist in OrientationHandler.

 

The documentation provides an example that uses onOrientationAboutToChange.

 

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

 

 

But the document says "Only has inherited QML signals".  It does not list onOrientationAboutToChange as a signal.

 

I'm using SDK 10.0.9.386 and the qml editor says Unknown signal when I try to attach an OrientationHandler..

 

Is OrientationHandler  completely implemented??

 

 

Please use plain text.
Developer
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: OrientationHandler does not support onOrientationAboutToChange signal

i haven't tried it but this may help (copied from the beta3 migration document):

 

Changes to the OrientationHandler class

The signals, uiOrientationChanging() and uiOrientationChanged(), which were previously in OrientationHandler, have moved to the OrientationSupport class and changed names. The uiOrientationChanging() signal is now orientationAboutToChange(), and theuiOrientationChanged() signal is now orientationChanged().

 

 

Please use plain text.
Contributor
cellinova
Posts: 11
Registered: ‎10-05-2012
My Device: Blackberry 10 Dev Alpha Device
My Carrier: Rogers

Re: OrientationHandler does not support onOrientationAboutToChange signal

Worked thanks.

Please use plain text.
Developer
vtong
Posts: 43
Registered: ‎08-02-2012
My Device: Z10
My Carrier: RIM

Re: OrientationHandler does not support onOrientationAboutToChange signal

I also have this issue.

 

 

I tried what you mentioned here but didn't work.

Please help

Please use plain text.
Developer
vtong
Posts: 43
Registered: ‎08-02-2012
My Device: Z10
My Carrier: RIM

Re: OrientationHandler does not support onOrientationAboutToChange signal

Tested: even though it still have "Unknow signal", the app run OK.

I think this is the IDE bug.

Please use plain text.
Contributor
bit-brad
Posts: 31
Registered: ‎11-02-2012
My Device: Dev Alpha
My Carrier: None

Re: OrientationHandler does not support onOrientationAboutToChange signal

So, are you using something like the following?

 

Page {

    Container {

        onCreationCompleted: {

            console.log("Created")

            OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;

        }

        attachedObjects: [

            OrientationSupport {

                onOrientationChanged: {

                    console.log("Testing orientation");

                }

            }

        ]

    }

}

 

This doesn't work for me. I am attaching this page to a sheet, if that makes any difference. I've tried many combinations including using OrientationHandler and orientationChanged.

Please use plain text.
Developer
ekke
Posts: 1,439
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: OrientationHandler does not support onOrientationAboutToChange signal

it should work this way:

attachedObjects: [
            // application supports changing the Orientation
            OrientationHandler {
                onOrientationAboutToChange: {
                    if (orientation == UIOrientation.Landscape) {
                        itemBackground.preferredWidth = 1280
                        highlightContainer.preferredWidth = 1272
                    } else {
                        itemBackground.preferredWidth = 768
                        highlightContainer.preferredWidth = 760
                    }
                }
            }
        ]

if your controls hav set the protrait values as default,

don't forget to test if the Page was opened in Landscape:

onCreationCompleted: {
        // set to Landscape if aklready in landscape while staring up
        if (OrientationSupport.orientation == UIOrientation.Landscape) {
            itemBackground.preferredWidth = 1280
            highlightContainer.preferredWidth = 1272
        }
    }

and of course your bar-descriptor.xml must have set Auto-Orientation

and your main.qml must set:

OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;

 you'll find all of this in my OpenDataSpace OSS App at github.

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Contributor
bit-brad
Posts: 31
Registered: ‎11-02-2012
My Device: Dev Alpha
My Carrier: None

Re: OrientationHandler does not support onOrientationAboutToChange signal

Ah awesome, thanks for the quick reply. I was missing the bar-descriptor property too. I also see that the IDE reports an unknown signal.
Please use plain text.
Developer
ekke
Posts: 1,439
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: OrientationHandler does not support onOrientationAboutToChange signal


bit-brad wrote:
Ah awesome, thanks for the quick reply. I was missing the bar-descriptor property too. I also see that the IDE reports an unknown signal.

this is already reported by me some time ago:

https://www.blackberry.com/jira/browse/BBTEN-310

 

and will be fixed in next versions

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
smiley
Posts: 1,427
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: OrientationHandler does not support onOrientationAboutToChange signal

I have followed the above code and even the sample app and yet my app won't receive the orientation changes.

 

Is there something that I have missed?

 

Please use plain text.