How to create a custom method to call and get the result from the method

HI,
What I’d like to ask is simply how I can create a custom method with XOJO that I can pass parameters to and get a result.
I’ve seen that it’s possible to create an Event in which I can specify the parameters and the output variable, but I can’t write the code inside.

Thanks

You can use the insert button in the upper left and then select Method. Screenshots are on macOS, but Windows should be the same.

Then you can name your method as well as define the parameters and return type.

Methods can be added to windows, your app object, modules, and classes.

Take note of the scope as well. Private methods can only be called from within the same object where they are defined.

You can read more about them here:

1 Like

example, i dropped the class into the window, then open the context menu via right mouse

then you have the method where you can place source code

you can also use a class/object as methods argument, this object is always by reference.
a class can store data, have functionality and encapsulate.

you can hold an class object also in a property of a window, but its by default nil and have to be created in the openinh event once with the new keyword.