home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / os2 / programm / 3938 < prev    next >
Encoding:
Text File  |  1992-07-31  |  2.3 KB  |  50 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!well!shiva
  3. From: shiva@well.sf.ca.us (Kenneth Porter)
  4. Subject: Constraining window size during WinCreateStdWindow
  5. Message-ID: <Bs9r4C.MJo@well.sf.ca.us>
  6. Keywords: AVIO
  7. Sender: news@well.sf.ca.us
  8. Organization: Kensington Labs Inc.
  9. Distribution: comp
  10. Date: Fri, 31 Jul 1992 19:50:35 GMT
  11. Lines: 37
  12.  
  13. I'm constructing a terminal emulator using a 40-character-wide AVIO
  14. window, and I want to constrain the size of the frame to the AVIO size,
  15. while allowing the desktop manager to otherwise set the initial position
  16. and size. Here's what I'm doing now:
  17.  
  18. When WM_CREATE is received by the client proc, it constructs a rect of
  19. the maximum client size (determined from VioGetDeviceCellSize and the
  20. AVIO row and and column numbers) and calculates the maximum frame size
  21. with WinCalcFrameRect (or the desktop dimensions, whichever is less).
  22.  
  23. The frame is subclassed in order to intercept WM_QUERYTRACKINFO and
  24. WM_ADJUSTWINDOWPOS. These are called during a sizing operation; the
  25. sizing constraint information that the client determined is passed to
  26. the caller.
  27.  
  28. (I also have to trap the frame's WM_CALCVALIDRECTS and return CVR_REDRAW
  29. as a simulaneous move/size operation (such as is done by the Tile Window
  30. and Cascade Window menus of the desktop manager) corrupts the AVIO
  31. position. The AVIO seems to slide under the left sizing border (ie. it
  32. appears to be drawn half a charcter cell to the left of where it should
  33. be). A subsequent sizing operation will repair the damage.)
  34.  
  35. I create the window with WinCreateStdWindow with FCF_SHELLPOSITION to
  36. allow the desktop manager to decide where to put the window, then
  37. WinQueryWindowPos followed by WinSetWindowPos to force the frame window
  38. to resize with the constraints in effect.
  39.  
  40. The downside of this is that the window briefly appears with a wide
  41. white border to the right of the AVIO space (ie. the frame is too wide)
  42. and then immediately resizes to the correct (narrower) size.  I thought
  43. that I could initially create the window invisible, issue the
  44. QueryPos/SetPos, then make the window visible, but then the sizing
  45. contraint doesn't take effect (leaving the big ugly white area on the
  46. right side of the client window).  It's as if WinSetWindowPos doesn't
  47. have any effect on invisible windows.
  48.  
  49. Can someone suggest a better way of accomplishing this goal?
  50.