Re: limiting size for a window
- Posted by DerekParnell (admin) Jun 12, 2010
- 2227 views
DerekParnell said...
SergioGelli said...
How is it possible to limit the reduction of a window to a specific minimum size?
I'll work on an example for you today. I've been busy at work this week so sorry for the delay.
Try this example...
include win32lib.ew integer Win constant min_width = 200, max_width = 700, min_height = 200, max_height = 700 constant mm_Reserved_X = 0, mm_Reserved_Y = 4, mm_MaxSize_X = 8, mm_MaxSize_Y = 12, mm_MaxPosition_X = 16, mm_MaxPosition_Y = 20, mm_MinTrackSize_X = 24, mm_MinTrackSize_Y = 28, mm_MaxTrackSize_X = 32, mm_MaxTrackSize_Y = 36 Win = create(Window, "Test Min Size", 0, 100, 100, 400, 400, 0) procedure Win_Event(integer id, integer event, sequence parms) atom s if parms[1] != WM_GETMINMAXINFO then return end if s = parms[3] poke4(s + mm_MinTrackSize_X, min_width) poke4(s + mm_MinTrackSize_Y, min_height) poke4(s + mm_MaxTrackSize_X, max_width) poke4(s + mm_MaxTrackSize_Y, max_height) end procedure setHandler(Win, w32HEvent, routine_id("Win_Event")) WinMain(Win, Normal)