Resize Canvas problem
BlitzMax Forums/BlitzMax Programming/Resize Canvas problem
| ||
Hi, Here is a little code I threw together to demonstrate what is happening in my program. Global Window:TGadget = CreateWindow("MVF IDE", 50, 50, 800, 600, Null, 15|WINDOW_CLIENTCOORDS) Global Canvas:TGadget = CreateCanvas(0, 0, 800, 600, Window) SetGadgetLayout Canvas, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED SetGraphics CanvasGraphics(Canvas) ActivateGadget Canvas SetClsColor 255, 255, 255 Cls Flip While WaitEvent() If EventID() = EVENT_WINDOWCLOSE Then End If EventID() = EVENT_GADGETPAINT Then Cls; Flip Wend Basically when I resize the window I still only have the orginal 800x600 white rectangle and the new part of the canvas is showing a messed up image (I believe it's the opening screen of guildwars which I was playing before I started woking on my program today). Also when I put ClientWidth(Canvas) in my code it displayed that when resized the canvas was bigger, so the canvas is resizing. But I also put a long string of text in and that became hidden under the messed up image as though the canvas had stopped. Calling SetGraphics CanvasGraphics(Canvas) again after the window had resized also didn't help. Is this just something that happens because I'm drawing in graphics memory that I didn't declare at the beginning of the program (complete guess as I have no idea how graphics and memory go together!)? Thanks for any help, Matthew |
| ||
It's the SetGadgetLayout command that's causing the problem and specifically EDGE_ALIGNED/RELATIVE as CENTRED works ok. P.S. You should always Setgraphics again in your gadgetpaint select. Setgadgetlayout <EDIT> In fact if you specify EDGE_ALIGNED,0,EDGE_ALIGNED,0 the problem doesn't occur. |
| ||
Ok thanks, I got it working now! Thanks Matthew |