Tool to center one window on another

From: Rick VanNorman <rick_at_forth.com>
Date: Tue, 09 Apr 2002 21:54:31 -0700

Dear Constant Reader,

This is the first in a set of tidbits for your enjoyment.

Enjoy,
Rick

{ ======================================================================
Centered.f

(C) 2002 Rick VanNorman
====================================================================== }

OPTIONAL CENTERED Center a child window in its parent

{ ----------------------------------------------------------------------
Given the handles of a child and parent window, move the child so it
is centered on the parent window.
---------------------------------------------------------------------- }

: CENTERED ( child parent -- ) LOCALS| dad me |
   [OBJECTS RECT MAKES MINE OBJECTS]
   me WINDOW-WIDTH MINE right ! me WINDOW-HEIGHT MINE bottom !
   dad WINDOW-WIDTH 2/ me WINDOW-WIDTH 2/ - MINE left !
   dad WINDOW-HEIGHT 2/ me WINDOW-HEIGHT 2/ - MINE top !
   dad MINE ADDR ClientToScreen DROP
    me MINE ADDR @RECT 1 MoveWindow DROP ;

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Tue Apr 09 2002 - 21:54:14 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.