3

So.. I just downloaded Xojo 2014 for OS X, and up to this point have found it a pretty simple and effective development environment.

However, I've been trying to make a function or sub routine for 45 minutes. Every time I try following tutorials or the Xojo documentation I get the following error:

enter image description here

I've followed (even though I could be missing something) the directions here: http://docs.xojo.com/index.php/Function

Even though there is no full example in the documentation (bad development environment).

Also, in the screen shot is showing a sample function I copied and pasted off Xojo forums and is supposed to work. I'm not a programming newb per say, but more an Xojo newb. I've also had experiences with silly bugs in RealStudio in the past.

Can someone maybe point out what I could be missing?

Samsquanch
  • 8,866
  • 12
  • 50
  • 89
rdc
  • 41
  • 1

3 Answers3

6

You cannot use the Function, Sub, End Function, or End Sub lines in the method editor. Doing so will cause a syntax error because method declarations are automatically added by the IDE based on the values you enter into the method editor's name, parameters, and return type fields.

e.g. enter image description here enter image description here

Andrew Lambert
  • 1,869
  • 1
  • 17
  • 31
1

as said,

Function, Sub, End Function, or End Sub is done for you,

you can do 'exit sub' if nothing need to be returned, else just return a proper value

like some events need a true or false, so if you need the exit the function, just return false

Berry
  • 51
  • 4
0

You cannot add inline functions within your Xojo code. You add methods to your project items these ways:

  • Insert->Method
  • "+" button on editor toolbar, then Method
  • Insert button on main toolbar, then Method
  • Option-Command-M (on OS X)
Paul Lefebvre
  • 6,253
  • 3
  • 28
  • 36