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
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Retrieving screen_display_t for current screen in Cascades

I'd like to retrieve the screen_display_t object at some point in my Cascades application. Since I am letting the operating system do all of the UI creation, I do not have direct knowledge of the context object which means I don't know how to retrive the display object. 

 

What's the best way to retrive the display object?

 

Thanks,

Scott

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: Retrieving screen_display_t for current screen in Cascades

Good question. 

You can retrieve a SCREEN_PROPERTY_DISPLAY from a window handle, but you first need a window handle.  Try just creating a new context and new window and reading this value.  If you are concerned about multi-display stuff, maybe you can attach the window to a ForeignWindowControl in your app first.

 

Curious what you're trying to do.

 

Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Retrieving screen_display_t for current screen in Cascades

I'm developing automated test tools. One type of test is a "Monkey" test where I inject thousands of touch events on the screen. If or when (usually when) the app crashes, I can look at the touch history and debug logs to find the weak spots in my application.

In a more controlled test, I map out specific touch sequences that should yield expected output. Then I check to see if the program's output is as was expected.

Scott
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Retrieving screen_display_t for current screen in Cascades

I've missed this on BlackBerry, even thought about writing my own a couple of months back.

If you need beta testers I put myself foward for consideration. Smiley Happy


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Retrieving screen_display_t for current screen in Cascades

Every window in Cascades has 'handle' property. This is your screen_window_t handle to the window in Native world. Use it to get display as Sean mentioned above.