Tutorial: View.setBounds

View.setBounds

Changes the position and size of a View within a window. View position is relative to the bounds of the window. ({top: 0, left: 0} represents the top left corner of the window)

Example

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

async function setViewBounds() {
    view = await createView();
    console.log('View created.');

    await view.navigate('https://google.com');
    console.log('View navigated to given url.');

    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));