Is there any way to set max size of window?

BlitzMax Forums/BlitzMax Programming/Is there any way to set max size of window?

fredborg(Posted 2006) [#1]
Hi,

Really the topic title says it all. Is there any way to set the maximal size of a window in max gui? Essentially an equivalent to SetMinWindowSize...


Perturbatio(Posted 2006) [#2]
I don't think there is natively, you *could* detect a window size event and restore it to your max size I suppose.


fredborg(Posted 2006) [#3]
There is now :) http://www.blitzbasic.com/Community/posts.php?topic=61002


ImaginaryHuman(Posted 2006) [#4]
I got around this by implementing my own resize gadget. Create a non-resizable window, watch the MOUSEDOWN events so that when the user clicks, you check the X,Y and if it's inside the `resize gadget area`, set a flag internally to say the user is beginning to resize, and record the starting X,Y position so you can resize relative to it, then whenever you get a MOUSEMOVE event, check if the coords are different to what they were in the previous frame, and if so, use SetGadgetShape to resize the window by adding StartingX-Event.X,StartingY-Event.Y to the original window width/height (which you keep stored). Then when you get a MOUSEUP event, check if the `was resizing` flag is set and if so, SetGadgetShape one more time for good measure and then set the resizing flag to false. Works fine for me. Then you can also easily implement maximum and minimum size restrictions by using Max() and Min() on the new mouse position.

The only drawback is you don't get a system default native-looking resize gadget. Which is not a big loss.


fredborg(Posted 2006) [#5]
I did this first as well, but I like this better. It's a simple addition ( although quite dispersed code wise :) ) to maxgui, and I see no reason it's not there in the first place.


SebHoll(Posted 2006) [#6]
I see no reason it's not there in the first place.

Ditto - lol!


tonyg(Posted 2006) [#7]
Maybe it should go in the bug forum?