Interacting with the Browser Environment through the WebClientUtils Plugin

The WebClientUtils plugin is a plugin that is not part of the default distribution of Servoy, but is hosted on ServoyForge.

The plugin adds the following capabilities to the Servoy environment:

For example to center the current webclient form with the WebClientUtils execute the following script in each form onRender:

 

if (event.getRenderable().getElementType() == ELEMENT_TYPES.FORM)
{
var form_account_script = "var main_form = document.getElementById('form_"+currentcontroller.getName()+"');";
form_account_script += "if (main_form != null){";
form_account_script += "main_form.style.width='940px';";
form_account_script += "main_form.style.left='50%';";
form_account_script += "main_form.style.top='0px';";
form_account_script += "main_form.style.bottom='0px';";
form_account_script += "main_form.style.position='absolute';";
form_account_script += "main_form.style.marginLeft='-470px';";
form_account_script += "}";
plugins.WebClientUtils.executeClientSideJS(form_account_script);
}

this example assuming your form is 940px wide.