In order to programmatically move a view from one window to another you can use the fin.Platform.createView() method. Aside from its obvious use of create new views to be added to a window you can use it to move existing views. You do this by supplying the identity of the view that you want to move instead of the view creation option. This know as reparenting a view.
It is important to know that a window will have its own identity and each view within that window will have its own unique identity.
** Note ** If your intention was to create a new view and you accidently supplied the values of the UUID and name options for in the creation option for a view that already exists the existing view will be moved and the new view will not be created. All other create options will be ignored.
Basic View Reparenting
fin.Platform.createView( <viewIdentity>, <windowIdentity>)
where: <viewIdentity> = the identity of the view you want to move
<windowIdentity> = the identity of the window to be moved to
One thing to bear in mind that this command will add the view to the end of the top most layout structure.
- If the top structure is a row the view will be moved to the right hand end of that row (the right side of the window).
- If the top structure is a column it will be moved to the bottom end of column (the bottom of the window).
- If the top structure is a stack then the view will be added to the last view of that stack.The view that is moved into place if given focus.
Move to a Layout Position
OpenFin provides a way of moving a view next to a view that is already in the window layout. If you want to add a view next to a view that already in the layout you can do this by adding the identity of that existing view.
fin.Platform.createView( <viewIdentity>, <windowIdentity>, <existingView>)
where: <viewIdentity> = the identity of the view you want to move
<windowIdentity> = the identity of the window to be moved to
<existingView> = the identity of the view you want to move next to
This will existing view is not already in a stack it will create a stack for that view and the view you are moving will be the last view in that stack. The view that has just been moved will be given focus.
Comments
0 comments
Please sign in to leave a comment.