Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Window.GetLeft

Queries X coordinate of a window.

Component Version macOS Windows Linux Server iOS SDK
Window 2.8 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "Window.GetLeft"; WindowRef )   More

Parameters

Parameter Description Example
WindowRef Window Reference is the unique OS level window ID. You can obtain this by using the Window.FindByTitle or Window.FindByIndex functions. Pass zero to access the frontmost window. 0

Result

Returns number or error.

Description

Queries X coordinate of a window.
See also Window.GetTop, Window.GetWidth and Window.GetHeight.

Examples

Get position of front window:

MBS( "Window.GetLeft"; 0 ) & "/" & MBS( "Window.GetTop"; 0 )

Figure out on which screen the first window is:

Let([
    WindowCenterX = MBS( "Window.GetLeft"; 0 ) + MBS( "Window.GetWidth"; 0 );
    WindowCenterY = MBS( "Window.GetTop"; 0 ) + MBS( "Window.GetHeight"; 0 );
    $ScreenIndex = -1;

    r = While (
    [
        c = MBS( "Screen.Count" );
        i = 0
    ] ;
    i < c ;
    [
        l = MBS( "Screen.Left"; i );
        t = MBS( "Screen.Top"; i );
        w = MBS( "Screen.Width"; i );
        h = MBS( "Screen.Height"; i );
        $ScreenIndex = If(
            (l ≤ WindowCenterX) AND
            (t ≤ WindowCenterY) AND
            (WindowCenterX ≤ l + w) AND
            (WindowCenterY ≤ t + h) ; i; $ScreenIndex );
        i = i + 1 ] ; 0 )

]; $ScreenIndex)

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 24th January 2024


Window.GetHeight - Window.GetMaxHeight