Panel resizing

BlitzPlus Forums/BlitzPlus Programming/Panel resizing

cbmeeks(Posted 2003) [#1]
I have an app that uses a tabber.

The way I do it is put a panel on each tab. Then, I put all of my gadgets on each panel. Then, when I switch tabs, I simply hide all but the selected panel. This works really well and is easy to control.

Now, the problem comes from resizing the main window. On each panel, I have a canvas. When I resize the window, the panel resizes ok but the canvas acts weird. It actually SCALES the image! How can I stop it from doing that?

Here are some snippets:

Global tile_panel=CreatePanel( 0,0,ClientWidth(tabber),ClientHeight(tabber),tabber,1 )
SetGadgetLayout tile_panel,1,0,1,0
SetPanelColor tile_panel,0,0,64
Global tile_can = CreateCanvas(0,0,(GadgetWidth(tile_panel)/TILE_WIDTH)*TILE_WIDTH,(GadgetHeight(tile_panel)/TILE_HEIGHT)*TILE_HEIGHT,tile_panel)
SetGadgetLayout tile_can,1,0,1,0


...

	If EventID()=$802											;window resize
	
		If EventSource()=window
			
			;resize canvases
			SetGadgetShape map_can,0,0,GadgetWidth(map_can), GadgetHeight(map_can)
			SetGadgetShape tile_can,0,0,GadgetWidth(tile_can), GadgetHeight(tile_can)

		End If
	
	
	End If


Thanks!

cb


Wiebo(Posted 2003) [#2]
You will have to recreate the canvas after each resize


Wiebo(Posted 2003) [#3]
.


BlitzSupport(Posted 2003) [#4]
He speaks the truth! Canvases have a fixed resolution -- the one you create them with -- so need to be re-built if you want to change their resolution. It should be pretty fast though...


cbmeeks(Posted 2003) [#5]
wow.

I was actually affraid of that. Seems wasteful.

I am trying to make a cool tile-editor for a project I am working on.

cb