Resizing the graphics window

Hi, I’m a newbie and am trying to resize my graphics window. When I try to resize it using the “resizable” option for the frame, I’m only able to resize the frame itself, not the picture in the frame if that makes sense. How do I resize the whole graphics window (frame and picture)? I attached my Xojo binary project so you can see what I mean in case it’s not clear from my question.

https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project

You need to respond to the resizing and/or resized events and reset your drawing parameters.

Thanks. Could you please give an example of that is?

In your app Open event, this is the line that sets the square size :

SquareWidth = 600 / Size

Place the same code in the window Resized event, and set the number to whatever the smaller side of the window is.

You may want to add code in the Resize event to insure that the window remains square.

Thanks, Michel. I don’t have a separate window Resized event. All I did was change the slider for the graphics window to “Resizeable” - should I not even use that option then, or use it in tandem with the new event? For the window Resized event, what would the pseudocode be? What do you mean by setting “the number to whatever the smaller side of the window is”? Thanks again.

All windows have a RESIZED and a RESIZING event. But they are not attached to the window by default…
You must add the event, just like you need to add events for MOUSEDOWN, MOUSEMOVE etc… etc…

The RESIZING event fires while the window is changing size (assuming you checked LIVE RESIZE
The RESIZED event fires when you release the mouse after RESIZING the window

Both of these events require the Windows RESIZABLE property to be set [see the Inspector]

Just add it by a right click on it and add… the same way you proceeded to add Pain, or the 8 other events you have already for GraphicsWindow. You did create that program yourself, did you not ?

Michel, I’ve added Pain to much of my code :wink:

I meant paint. Typed too fast :wink: But don’t we all experience pain and suffering in our code sometimes ?

Samuel, you might be interested in the example project that shows how to resize an image at xojobyexample.com

Thanks, guys. I added the RESIZED and RESIZING events and set the window so that the frame is Resizeable and so that it enables Live Resize. I also added the following code to each event

App.SquareWidth = 600 / App.Size 

But I still have the same problem, where the window is resizable but not the picture (contents) of the frame itself. Any suggestions?

The program: https://www.dropbox.com/s/2rneozqhtijoc7v/MyApp.xojo_binary_project

You’re not using any info about the new size of the window, so you’re just getting the same fixed values.

[quote=94001:@Samuel Cohen]I added the RESIZED and RESIZING events and set the window so that the frame is Resizeable and so that it enables Live Resize. I also added the following code to each event

App.SquareWidth = 600 / App.Size
But I still have the same problem, where the window is resizable but not the picture (contents) of the frame itself. Any suggestions?[/quote]

You may want to ask the person who created the program for help.

The line I indicated is part of the Open event of the App. By itself, it cannot redraw anything. The whole code in the Open event is used to draw the square. So that is what you want to copy, and set the size of the square relative to the smaller side of the window.