🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #618

Constraining window size during WinCreateStdWindow

#618
From: Kenneth Porter
Date: Fri, 31 Jul 1992 19:50
37 lines
2401 bytes
I'm constructing a terminal emulator using a 40-character-wide AVIO
window, and I want to constrain the size of the frame to the AVIO size,
while allowing the desktop manager to otherwise set the initial position
and size. Here's what I'm doing now:

When WM_CREATE is received by the client proc, it constructs a rect of
the maximum client size (determined from VioGetDeviceCellSize and the
AVIO row and and column numbers) and calculates the maximum frame size
with WinCalcFrameRect (or the desktop dimensions, whichever is less).

The frame is subclassed in order to intercept WM_QUERYTRACKINFO and
WM_ADJUSTWINDOWPOS. These are called during a sizing operation; the
sizing constraint information that the client determined is passed to
the caller.

(I also have to trap the frame's WM_CALCVALIDRECTS and return CVR_REDRAW
as a simulaneous move/size operation (such as is done by the Tile Window
and Cascade Window menus of the desktop manager) corrupts the AVIO
position. The AVIO seems to slide under the left sizing border (ie. it
appears to be drawn half a charcter cell to the left of where it should
be). A subsequent sizing operation will repair the damage.)

I create the window with WinCreateStdWindow with FCF_SHELLPOSITION to
allow the desktop manager to decide where to put the window, then
WinQueryWindowPos followed by WinSetWindowPos to force the frame window
to resize with the constraints in effect.

The downside of this is that the window briefly appears with a wide
white border to the right of the AVIO space (ie. the frame is too wide)
and then immediately resizes to the correct (narrower) size.  I thought
that I could initially create the window invisible, issue the
QueryPos/SetPos, then make the window visible, but then the sizing
contraint doesn't take effect (leaving the big ugly white area on the
right side of the client window).  It's as if WinSetWindowPos doesn't
have any effect on invisible windows.

Can someone suggest a better way of accomplishing this goal?
Technical Details
Message-ID: <Bs9r4C.MJo@well.sf.ca.us>
Path: arc1-ca.pugleaf.net!sparky!uunet!well!shiva

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!well!shiva
From: shiva@well.sf.ca.us (Kenneth Porter)
Subject: Constraining window size during WinCreateStdWindow
Message-ID: <Bs9r4C.MJo@well.sf.ca.us>
Keywords: AVIO
Sender: news@well.sf.ca.us
Organization: Kensington Labs Inc.
Distribution: comp
Date: Fri, 31 Jul 1992 19:50:35 GMT
Lines: 37