Disallowing moving a window (>JUDITH)
- Posted by martin.stachon at worldonline.cz Jul 21, 2001
- 393 views
This is a multi-part message in MIME format. ------=_NextPart_000_000A_01C11202.83BCAF20 charset="iso-8859-2" Hello, this example shows how to disallow moving a window (better method then setting postion back with each move, which causes flickering and appearing 'ghost' window - the method IDE = uses) I have written it for Judith, but I think this can be useful also for = others. <CODE :> include win32lib.ew constant WM_WINDOWPOSCHANGING =3D #0046 constant flags =3D 4+4+4+4+4+4 -- six members in the WINDOWPOS struct -- before flags constant mainWindow =3D create (Window, "Test", 0, 100, 100, 100, 100, 0) -- testing window procedure onEvent_mainWindow(atom event, atom wParam, atom lParam) -- lParam is pointer to WINDOWPOS structure atom cur_flags if event =3D WM_WINDOWPOSCHANGING then -- Windows tell us they are = about to move a window cur_flags =3D peek4u(lParam + flags) -- give the current flags (UInt) poke4(lParam+flags,or_bits(SWP_NOMOVE,cur_flags)) -- combine the = current flags with end if --SWP_NOMOVE, which disallows moving end procedure onEvent[mainWindow] =3D routine_id("onEvent_mainWindow") -- register for as much windows as you want WinMain(mainWindow, Normal) </CODE> ___ Regards, Martin Stachon martin.stachon at worldonline.cz http://www.webpark.cz/stachon ------=_NextPart_000_000A_01C11202.83BCAF20 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3D"Arial CE" size=3D2>Hello,<BR>this example shows how = to disallow=20 moving a window<BR>(better method then setting postion back with each=20 move,<BR>which causes flickering and appearing 'ghost' window - the = method IDE=20 uses)<BR>I have written it for Judith, but I think this can be useful = also for=20 others.<BR><BR><CODE :><BR><CODE><PRE><FONT = color=3D#0000ff>include </FONT>win32lib.ew <FONT color=3D#0000ff>constant</FONT> WM_WINDOWPOSCHANGING =3D #0046 <FONT color=3D#0000ff>constant</FONT> flags =3D 4+4+4+4+4+4 <FONT color=3D#ff0055>-- six members in the WINDOWPOS struct</FONT> <FONT color=3D#ff0055>-- before flags</FONT> <FONT color=3D#0000ff>constant </FONT>mainWindow =3D create <FONT color=3D#993333>(</FONT>Window, <FONT = color=3D#00a033>"Test"</FONT>, 0, 100, 100, 100, 100, 0<FONT = color=3D#993333>) </FONT><FONT color=3D#ff0055>-- testing window</FONT> <FONT color=3D#0000ff>procedure </FONT>onEvent_mainWindow<FONT = color=3D#993333>(</FONT><FONT color=3D#ff00ff>atom </FONT>event, <FONT = color=3D#ff00ff>atom </FONT>wParam, <FONT color=3D#ff00ff>atom = </FONT>lParam<FONT color=3D#993333>)</FONT> <FONT color=3D#ff0055> -- lParam is pointer to WINDOWPOS = structure</FONT> <FONT color=3D#ff00ff> atom </FONT>cur_flags <FONT color=3D#0000ff> if </FONT>event =3D WM_WINDOWPOSCHANGING <FONT = color=3D#0000ff>then </FONT><FONT color=3D#ff0055>-- Windows tell us = they are about to move a window</FONT> cur_flags =3D <FONT color=3D#ff00ff>peek4u</FONT><FONT = color=3D#993333>(</FONT>lParam + flags<FONT color=3D#993333>) = </FONT><FONT color=3D#ff0055>-- give the current flags (UInt)</FONT> <FONT color=3D#ff00ff> poke4</FONT><FONT = color=3D#993333>(</FONT>lParam+flags,<FONT = color=3D#ff00ff>or_bits</FONT><FONT = color=3D#330033>(</FONT>SWP_NOMOVE,cur_flags<FONT = color=3D#330033>)</FONT><FONT color=3D#993333>) </FONT><FONT = color=3D#ff0055>-- combine the current flags with</FONT> <FONT color=3D#0000ff> end if </FONT><FONT color=3D#ff0055>--SWP_NOMOVE, = which disallows moving</FONT> <FONT color=3D#0000ff>end procedure</FONT> onEvent<FONT color=3D#993333>[</FONT>mainWindow<FONT color=3D#993333>] = </FONT>=3D <FONT color=3D#ff00ff>routine_id</FONT><FONT = color=3D#993333>(</FONT><FONT = color=3D#00a033>"onEvent_mainWindow"</FONT><FONT = color=3D#993333>)</FONT> <FONT color=3D#ff0055>-- register for as much windows as you want</FONT> WinMain<FONT color=3D#993333>(</FONT>mainWindow, Normal<FONT = color=3D#993333>)</FONT> </PRE></CODE><BR></CODE><BR><BR>___<BR>Regards,<BR>Martin = Stachon<BR><A=20 href=3D"mailto:martin.stachon at worldonline.cz">martin.stachon at worldonline.= cz</A><BR><A=20 href=3D"http://www.webpark.cz/stachon">http://www.webpark.cz/stachon</A><= ------=_NextPart_000_000A_01C11202.83BCAF20--