Code test failure

I am messing around with a test project and I am using a snippet of code from the xojo online frameworks referrence, that code gives an error. It is a KeyDown function and I have placed it in the Keydown section of the window event handler. Here is the online reff.

Function KeyDown (Key As String) As Boolean Select Case Asc(Key) Case 31 // up arrow Yscroll = YScroll - 8 Canvas1.Scroll(0, -8) Case 29 // Right arrow Xscroll = XScroll - 8 Canvas1.Scroll(-8, 0) Case 30 // Down arrow YScroll = YScroll + 8 Canvas1.Scroll(0, 8) Case 28 // Left arrow XScroll = XScroll + 8 Canvas1.Scroll(8, 0) End Select

The function line give me Syntax Error “Function (Key As String) As Boolean”, is this no longer valid?

That line should not appear in YOUR code, it is automagically added by Xojo

Function KeyDown (Key As String) As Boolean

and I “assume” in the last line of your post you actually FORGOT to include the word “KEYDOWN”