If I recall correctly, it is possible to create a Method (or Function) with a variable number of parameters.
From memory:
Method Foo (X As Integer, Y As Integer)
Method Foo (X As Integer, Y As Integer, Width As Integer, Height As Integer)
What I forgot is how this works.
I think I have to place the code to deal with the first set of Parameters (X, Y) in another method and call it from both Methods, and add code to deal with (Width, Height) in the second Method.
My simple question is: is thats all ? (Xojo do the job by its own / silently ?)
[quote=325601:@Emile Schwarz]Method Foo (X As Integer, Y As Integer)
Method Foo (X As Integer, Y As Integer, Width As Integer, Height As Integer)[/quote]
That is called “method overloading”.
Tim: separating it out into 2 methods will be the road to go.
Eli:
That is the point I forgot !
Tim, Eli: Thank you.
Usage:
I have implemented a way to remember Window position (X,Y,W,H), Listbox Sort, Listbox Selected Row (only one Row can be selected) and now I was thinking to save some more information, but only for one window that display a different kind of information that is based on a year set in a TextField, the user can press a PushButton to get predetermined Statistics from a SQLite DB file: opening the window to its own location, etc. with nothing inside the Listbox seems a bit stupid. I can save the clicked PushButton (if any) and Push it at window open time, so the user gets what (s)he had at window close time.
I was not sure about the way it works / it was a long time since someone talks here about method overloading.