Tutorial: View.setBounds

View.setBounds

Shows the View on a window.

Example

let view;
async function createView() {
    const me = await fin.Window.getCurrent();
    return fin.View.create({ 
        url: 'https://google.com', 
        name: 'viewNameSetBounds', 
        target: me.identity, 
        bounds: {top: 10, left: 10, width: 200, height: 200} 
    });
}

async function setViewBounds() {
    await createView();
    console.log('View created.');
    const me = await fin.Window.getCurrent();
    view = fin.View.wrapSync({ uuid: me.identity.uuid, name: 'viewNameSetBounds' });
    await view.setBounds({
        top: 100,
        left: 100,
        width: 300,
        height: 300
    });
}

setViewBounds()
    .then(() => console.log('View set to new bounds.'))
    .catch(err => console.log(err));