Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I restrict attempted resizing of a screen to an invalid side?
#1
Apologies for so many questions. Unfortunately, there are just some things I cannot seem to figure out on my own :-)

Let's assume a create a screen like this:

 
Code: (Select All)
                oldimage& = handle&
                handle& = _NewImage(Horizontal, Vertical, 256)
                Screen handle&
                _FullScreen _Off
                _FreeImage oldimage&

I allow the user to resize the screen, but I want to restrict them from making the windows smaller than 400 x 400. That part I can do. I simply check the width and height after resizing the screen and if either width or height is less than 400 I change it to 400.

My concern is that while the user is dragging a corner of the screen to resize it, they can drag it to a point where it causes my program to crash while they are still dragging the corner but before I can check it and resize it. See the screenshot below for an example.

Put another way, I can check the size of the screen AFTER they have resized it, but I can't prevent them from dragging the corners to a ridiculously small size that causes a crash. Is there any way to prevent this?

   
Reply
#2
If there isn't a technical way to do it, I'd just error trap it and have the error routine resize the window to the minimum size. Maybe even put up a warning for the user.

Look up ON ERROR

Pete
If eggs are brain food, Biden has his scrambled.

Reply
#3
About the only way I know to handle such issues flawlessly is to turn $RESIZE off and then handle sizing internally via some user dialog.

INPUT "How wide would you like the screen (400 to _DESKTOPWIDTH) pixels: ", wide
If wide < 400 then SlapTheUser_SetWideTo400
Reply
#4
I managed to get this working. I implement it in the "Word Clock" program that I posted yesterday. If the user attempts to resize to something smaller than 200 pixels high or wide, the program automatically forces it back to the minimum of 200 x 200.
Reply




Users browsing this thread: 1 Guest(s)