Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3811

Method parameters names in call

$
0
0

Hi all, hopefully I didn’t just miss this but I am wondering if Xojo has a way to specify parameter names in the call. C# does this. In C# say you have

public void DoSomething( int parm1, string parm2, double parm3 )

You can call this with the parm name: DoSomething( parm1:29, parm2:“Hello”, parm3:3.1415 )

This can be really handy if you have a method with a fair number of parameters. I’m wondering if Xojo has anything similar?

In general, keeping with OO principles I try hard not to have methods with lots of parameters. But at times you need them. For example I use MessageDialog to prompt the user. There are a lot of options to a MessageDialog so I’ve created my own method:

ShowWarningDialog(caption as string, message as string, explanation as string, actionButtonText as String)

While there are only four parms to this one, it would be super nice to be able to call it like:

ShowWarningDialog( caption:“Hello World”, message:“It’s gonna be a great day”, explanation:“Because I lived to see it”, actionButtonText:“Let’s go”)

It makes it really clear what is being assigned to what.

10 posts - 6 participants

Read full topic


Viewing all articles
Browse latest Browse all 3811

Trending Articles