NTK and The NTK Project
are properties of Jn Dechereux
Home | Documentation | FAQ.

Vanilla 1.1.8 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorPoke45
    • CommentTimeJan 30th 2022
     
    in my own testing "NTK_CENTERWINDOW" is resizing the window: the width and height of the window was being extended i.e. as compared to the width and height of the displayed window if you comment out the call to NTK_CENTERWINDOW

    i wrote my own method using the NTK "GETWINDOWRECT" and "MOVEWINDOW" methods and this works fine i.e. centers the window without changing its width / height:

    ___

    Function CenterWindow(hWnd, hWndParent)

    local aPos
    local aParentRect := NTK_GETWINDOWRECT(hWndParent)
    local aRect := NTK_GETWINDOWRECT(hWnd)
    local nHeight
    local nWidth

    nWidth := aRect[3] - aRect[1]
    nHeight := aRect[4] - aRect[2]

    aPos := {INT((aParentRect[1] + aParentRect[3] - nWidth) / 2), INT((aParentRect[2] + aParentRect[4] - nHeight) / 2)}
    // [note] aPos is now the new desired SCREEN co-ordinates of our window

    NTK_MOVEWINDOW(hWnd, MAX(aPos[1], 0), MAX(aPos[2], 0), nWidth, nHeight, .F.)

    return NIL

    ___