Re: limiting size for a window
- Posted by dcole Jun 11, 2010
- 2280 views
CoJaBo said...
It probably doesn't work because this isn't the correct way to do it. You want to check the dimensions before the resize, not re-resize the window after it is resized.
I disagree, you have to check to dementions after the resize to see if they fit your requirments.
I ran the following test with Window XP.
include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) --------------------------------------------------------- include win32lib.ew procedure Window1_onResize (integer self, integer event, sequence params)--params is ( int style, int cx, int cy ) sequence s integer xx,xy xx=400 xy=300 s=getCtlSize(Window1) if s[1]<xx or s[2]<xy then setCtlSize(Window1,xx,xy) end if end procedure setHandler( Window1, w32HResize, routine_id("Window1_onResize")) WinMain( Window1,Normal )
and it does work. If the window is smaller than 400,300 then it snaps back to 400,300.
I don't know why it wouldn't work in Linux.
Don Cole