WebSDK2: how to get the actual width or height of a control?

Hi @Greg_O_Lone , or @Anthony_G_Cyphers

when using a websdkuicontrol, how can I get the actual width (or height) of a control ?
if I use the locks top,left,right or bottom of the control, the control size on the client browser is different from the control size in the ide
if I check me.width, I get the width of the control in the IDE

how can I get the real, actual width of the control at runtime ?

thanks.

You need to try using mWidth or js.x_position.width. What you found is a bug that I reported a few months ago.feedback://showreport?report_id=64998

1 Like

just digged into the browser side. it seems to me that you get something from js.lockinfo.right
but it’s still not exactly the right position of the streched websdkuicontrol ?

more digging and I found it…

updateControl(data) {
        super.updateControl(data);
        let js = $.parseJSON(data);

        // find control width
        let w = 0;
        if (js.x_position.viewwidth != null) {
            if (js.x_position.locks.right) {
                w = (window.visualViewport.width - js.x_position.viewwidth) + js.x_position.width;
            } else {
                w = js.x_position.width;
            }
        }

beware of the letter case… window is not the same as Window !

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.