Re: My windows don't open to the right size!!??
- Posted by Brian Broker <bkb at CNW.COM> May 16, 2000
- 422 views
On Tue, 16 May 2000 19:03:50 -0400, David Roach <roachd_76 at YAHOO.COM> wrote: >Could someone tell me why when I open a window using WinLib they do not >open to the full size that I say. For example if I put 500,500 for the >window size it opens to 491,443. Why is this. Is there a way to keep this >from happening. Not a real problem just an anoyance. I think you are confusing the Window size and the Window's client size. If you run the program below, you will see what I mean. The x and y passed to onResize() are the client size of the Window. If you want the size of the window (including title/menu/borders/etc.) then you should use 'getExtent'. -- sample code -- include win32lib.ew without warning constant Win = create( Window, "Window", 0, Default, Default, 500, 500, 0 ), Txt1 = create( LText, "", Win, 10, 10, 150, 20, 0 ), Txt2 = create( LText, "", Win, 10, 30, 150, 20, 0 ), Txt3 = create( LText, "", Win, 10, 50, 150, 20, 0 ) procedure onResize_Win( integer style, integer x, integer y ) sequence extent, client extent = getExtent( Win ) setText( Txt1, sprintf( "getExtent() Size: %d x %d", { extent[1], extent[2] } ) ) setText( Txt2, sprintf( "onResize() Size: %d x %d", {x,y} ) ) client = getClientRect( Win ) setText( Txt3, sprintf( "getClientRect() Size: %d x %d", { client[3], client[4] } ) ) end procedure onResize[Win] = routine_id( "onResize_Win" ) WinMain( Win, Normal ) -- end sample code -- -- Brian