Page 1 of 1

How to limit Window Resizing

Posted: Wed May 17, 2006 6:47 pm
by naw
Hi

Is there a way to allow a window to resize only vertically or only horizontally.
I'm doing it a rather ugly way (see code below) which works but the effect is a bit wierd...

Code: Select all

   OpenWindow(0, 150, 130, 530, 350, "", #PB_Window_SizeGadget)
   Repeat
    _eventId=WaitWindowEvent()
    ResizeWindow(0,#PB_Ignore,#PB_Ignore, 530,#PB_Ignore)
  Until _eventId=#PB_Event_CloseWindow

Posted: Wed May 17, 2006 7:14 pm
by netmaestro
The message #WM_GETMINMAXINFO is sent whenever the size of a window is about to change. The lparam value of this message contains a pointer to a MINMAXINFO structure containing min/max specs. This message and pointer are sent for the express purpose of enabling programs to alter this information to suit the needs of the application. Here's a thread where there are some examples shown:

http://www.purebasic.fr/english/viewtop ... ght=resize

Posted: Thu May 18, 2006 6:58 pm
by naw
Hey thanks netmaestro - thats exactly what I wanted :-)