1. Re: my windows don't open to the right size
- Posted by wolfgang fritz <wolfritz at KING.IGS.NET> May 17, 2000
- 365 views
I just couldn't help but play with Brian's example ...Wolf -- sample code -- include win32lib.ew without warning constant {C_POINTER,C_INT,C_INT},C_INT) atom junk,rect,x1,y1,x2,y2 rect= allocate_struct( SIZEOF_RECT ) store(rect, rectLeft, 0) store(rect, rectTop, 0) store(rect, rectRight, 500) -- desired size *** store(rect, rectBottom, 350) -- of client area. *** -- normal win32lib window style with a menu -- rectLeft and rectTop will return negative, so... x1=abs(fetch(rect,rectLeft)) y1=abs(fetch(rect,rectTop)) x2=fetch(rect,rectRight) y2=fetch(rect,rectBottom) constant -- now includes borders+titlebar+menu+desired clientsize Win = create( Window, "Window", 0, 0, 0, x1+x2, y1+y2, 0), menu = create( Menu, "Hello", Win, 0, 0, 0, 0, 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 --