ww@beach.cis.ufl.edu (Wayne Wolf) (04/25/91)
Attention all Windows gurus!!! This is a struggling novice Windows
programmer's cry for help.
I have just received Turbo Pascal for Windows and I'm having a
little difficulty making the transition from Turbo Vision to Windows.
The problem:
------------
I am trying to create a window (child) within a window (parent). I
want the child window to be constrained by the boundaries of the
parent window AND I want it to be unmovable. The child window will
have a title and a border.
My inept solution:
------------------
I have successfully gotten the child window created and belonging to
the parent, with the title and border. This was done by setting the
child window's style as folows:
Style := ws_Child or ws_Caption or ws_Visible;
The window comes up fine and everything is dandy, EXCEPT that I am
allowed to move the danged child window all around inside the parent.
I want to inhibit this behavior. I've looked high and dry for a simple
way to prevent the child window from being movable, and I've come up
empty-handed. The move behavior seems to be tied to having that title-bar,
cuz if I set the window to eliminate the ws_Caption option and add
ws_Border style, then the window cannot move.
The not-so-simple solution I can see is to intercept the Mouse-Down and
Mouse-Move messages to prevent this combination from moving the window.
At my level of (in)experience, this is a monumental task right now, and
I'd like not to have to do it this way if there is a much easier solution.
I am using ObjectWindows classes (specifically my own descendants of
TWindow) for my implementation, as follows:
Constructor TChildWindow.Init(AParent:PWindowsObject; ATitle:PChar);
Begin
TWindow.Init(AParent,ATitle);
with Attr do begin
Style := ws_Child or ws_Caption or ws_Visible;
x := 10; y:= 10; W:=200; H:=200;
end; {with}
End;
Any suggestions are appreciated. Solutions do not have to be
ObjectWindows solutions, or even Pascal oriented. If there are any
Windows functions that set a window to non-movable this would be ideal.
Thanx in advance.
..
Wayne Wolf
Struggling novice Windows programmer
Internet : ww@beach.cis.ufl.edubonneau@hyper.hyper.com (Paul Bonneau) (04/26/91)
In article <1991Apr24.183126.5328@b11.ingr.com> ww@beach.cis.ufl.edu writes: > >The problem: >------------ >I am trying to create a window (child) within a window (parent). I >want the child window to be constrained by the boundaries of the >parent window AND I want it to be unmovable. The child window will >have a title and a border. > Trap the WM_SYSCOMMAND message, and if wParam is SC_MOVE, *don't* call DefWindowProc(). cheers - Paul Bonneau.