Rect on canvas

BlitzPlus Forums/BlitzPlus Programming/Rect on canvas

MattVonFat(Posted 2004) [#1]
Hi. I want to do a selection box on a canvas but the Rect end coords dont seem to work properly. Can anyone help?

AppTitle "test"

mainWin = CreateWindow("test", 0, 0, 700, 500, 0, 9)
imageCan = CreateCanvas(20, 20, 300, 300, mainWin)

SetBuffer CanvasBuffer(imageCan)

While WaitEvent() <>  $803

	If EventID() = $203
		SetStatusText mainWin, EventX() + "," + EventY()
	End If
	
	If EventID() = $201
		
		mx = EventX()
		my = EventY()
		
		While WaitEvent()
			If EventID() = $203
				Cls
				Rect mx, my, EventX(), EventY()
				FlipCanvas imageCan
			End If
			If EventID() = $202
				Exit
			End If
		Wend
		
	End If

Wend



CS_TBL(Posted 2004) [#2]
replace 'Rect' .. with 'Line' .. do you see the issue then?

if no:

Rect mx, my, EventX()-mx, EventY()-my

Rect works with x,y,width,height .. while your routine is done for: x1,y1,x2,y2 .. slightly different ..


MattVonFat(Posted 2004) [#3]
I cant believe i did something like that! It may be because i was dealing with HTML Image Maps and they use Rect and startX, startY, endX, endY.

Thanks