Possible to get the Width of a form in Javascript?

Hi all,

I’m trying to write a genric method to open a form in a Dialog.
Is there a way of finding the width of a named form?

var v = forms['myform'].width;

Doesn’t seem to work.

Or will I have to pass the width as a parameter to my method?

Hi Christian,

If you just want to use the current width of the form you open then just use -1 as width parameter in the ShowFormInDialog.

Hope this helps.

Just to expand Roberts answer you can use four -1’s and Servoy will automatically centre the Form in Dialogue on the screen and set both width and height.

application.showFormInDialog( form, -1, -1, -1, -1, [dialog_title], [resizable], [showTextToolbar], [closeAllOnCloseButton])

Graham Greensall
Worxinfo Ltd

Thanks Graham :)

One thing with the height parameter though.
When you have a listview, and I guess also with the table view, is that you might want to set the height then or you get unexpected results.

I.e. a very small (as in height) window.

Hope this helps.

ROCLASI and Graham:
-1

I had a feeling there would be a really easy way to do this :slight_smile:

Thanks!