Board index » delphi » Are there Optional Parameters like in VB

Are there Optional Parameters like in VB

 does Delphi have optional parameters like visual basic.

I'm in the process of converting over some apps from VB to Delphi 3, I need
to be able to pass some optional parameters to a procedure. I was able to do
this in VB and then use an "IsMisssing" function to test if the parameter
was skipped.

thanks

 

Re:Are there Optional Parameters like in VB


Quote
Keric P.Donnelly wrote:

>  does Delphi have optional parameters like visual basic.

        No optional parameters, sorry. (You can use an
array of const or an array of pointer or some such to
sort of fake it.)

--
David Ullrich

sig.txt not found

Re:Are there Optional Parameters like in VB


Quote
In article <34059C79.1...@math.okstate.edu> David Ullrich <ullr...@math.okstate.edu> writes:
>>  does Delphi have optional parameters like visual basic.
>        No optional parameters, sorry. (You can use an
>array of const or an array of pointer or some such to
>sort of fake it.)

Yes, and that actually works pretty darned good.  Delphi has a number of
features specially targeted toward that, and a surf to SYSUTILS.PAS in the
source code is a great example of how that works.

I think that the "array of const" idea was actually an extremely astute way
to implement this feature.  I remember how HP did it... ick.

Re:Are there Optional Parameters like in VB


Quote
David Ullrich wrote:

> Keric P.Donnelly wrote:

> >  does Delphi have optional parameters like visual basic.

>         No optional parameters, sorry.

Sorry? Great for Pascal, saving us from introducing obscure and hard to
trace bugs.

Robert

Re:Are there Optional Parameters like in VB


Quote
Sundial Services wrote:

> In article <34059C79.1...@math.okstate.edu> David Ullrich <ullr...@math.okstate.edu> writes:

> >>  does Delphi have optional parameters like visual basic.

> >        No optional parameters, sorry. (You can use an
> >array of const or an array of pointer or some such to
> >sort of fake it.)

> Yes, and that actually works pretty darned good.  Delphi has a number of
> features specially targeted toward that, and a surf to SYSUTILS.PAS in the
> source code is a great example of how that works.

> I think that the "array of const" idea was actually an extremely astute way
> to implement this feature.  I remember how HP did it... ick.

        Right - I certainly didn't mean to give the impression that I
had any complaints with the way "array of const" works.

--
David Ullrich

sig.txt not found

Other Threads