§ TWMSizing record for Delphi
One way to control custom window sizing is to use the WM_SIZING message, but Delphi doesn't give you what you need to do so.
My (old) copy of MSDN shows:
WM_SIZING fwSide = wParam; // edge of window being sized lprc = (LPRECT) lParam; // screen coordinates of drag rectangle
which is identical to WM_MOVING. Actually, the MSDN pages for WM_MOVING and WM_SIZING are nearly identical. In fact, WM_MOVING uses the constants for WM_SIZING, e.g. WMSZ_BOTTOMLEFT. I can't think why; I never seen a Windows window movable by anything but the titlebar. Intrestingly, the Windows.pas unit has the WMSZ_BOTTOMLEFT et. al. constants, although I don't see them used elsewhere in the source.
TWMMoving from Messages.pas:
TWMMoving = packed record Msg: Cardinal; Edge: Integer; DragRect: PRect; end;
which has no result. I mean, MSDN says, "An application should return TRUE if it processes this message." (That goes for either WM_MOVING or WM_SIZING.)
So here's TWMSizing:
type TWMSizing = packed record Msg: Cardinal; Edge: Integer; DragRect: PRect; Result: Longint; end;
This lets you do something like:
procedure WMSizing(var Message: TWMSizing); message WM_SIZING; ... procedure TForm2.WMSizing(var Message: TWMSizing); begin case Message.Edge of WMSZ_BOTTOMRIGHT: begin Message.DragRect.Bottom := Top + Height; //can make it wider but not taller Message.Result := 1; //return TRUE end; WMSZ_BOTTOMLEFT: begin Message.DragRect.Left := Left; //can make it taller but not wider Message.Result := 1; //return TRUE end; end; end;
last edited on May 7th, 2010 at 6:38 PM
- Walid on "Adventures with Ubuntu 9.10 on G4 Yikes!" - I am in the same process as you. Although I still dual-boot to Windows for my ganimg leisure. My first contact with Ubuntu was way…
- Slashback on "Simpler adding & removing element classnames" - Actually, the addClassName function does what you want, pretty much the same way you suggest.
- angie on "Simpler adding & removing element classnames" - And what if I want to add a class, but keeping the csseals the element already has?I mean, I have an element with a class, let's name…
- backlinks on "Adjust iframe height to contents" - Definitely helped me.
- Slashback on "Simpler validate form fields are filled in (no additional class names)" - You are welcome!