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.
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.
Container { id: indicators layout: AbsoluteLayout {} touchPropagationMode: TouchPropagationMode.Full background: Color.DarkGray attachedObjects: [ LayoutUpdateHandler { id: handler } ] property alias width: handler.layoutFrame.width; property alias height: handler.layoutFrame.height; }Now you can use width and height property to know control's actual size.