Sharing information related to Qt, Maemo development and some other information

Tuesday, July 23, 2013

Getting Size of control in BB10 Cascades API

I was working on update for my Audiobook Reader application for BB10. I wanted to create a custom control like shown below and I required to use AbsoluteLayout to create it.

In this case layouting needs to be done manually and to do that we need to consider width and height of the controls and position controls using those. But unlike Qt Quick, BB10 Cascades controls does not provide access to width, height and x,y properties.

However Cascades API offers LayoutUpdateHandler control, this control gets notification when layout is complete and with notification it offers actual location and size of control and it also store these values in it's layoutFrame property. I used that to find out size of control and did required layouting.

Following code shows how LayoutUpdateHandler can be used to find out size of control.

3 comments:

What formats does your Audio Book reader accept? I cannot get it to detect my files from Audible on my Blackberry Q10. When I navigate to the folder to "add a book" it sees nothing in the folder where the audio files are.

Regarding not able to see files, Are you trying to browse SD card or Phone memory. There is problem browsing certain kind of SD card, API does not return files list, it may be same issue with you as well.