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
d3v3l0p3r
Posts: 168
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook

How to change Container Layout?

When I do container.setLayout(DockLayout); from JavaScript it works (no error) but the container layour does not change.

---
If you find my post helpful please "like" it and "accept as a solution"
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How to change Container Layout?

[ Edited ]

Untested, but should work:

 

attachedObjects: [
  ...,
  ComponentDefinition {
    id: dockLayoutFactory
    content: DockLayout {}
  }
]
...
container.layout = dockLayoutFactory.createObject(container);

 

or a single liner (less efficient):

container.layout = Qt.createQmlObject('import bb.cascades 1.0;DockLayout{}', container, 'codeSnippet');

 'codeSnippet' is pseudo-filename used for error reporting. Replace it with any string.


Andrey Fidrya, @zmeyc on twitter