Subject Re: modal form
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 20 Aug 2020 11:18:47 +0200
Newsgroups dbase.getting-started

On 2020-08-19 23:19, Gaetano wrote:
>
> Hi Lee,
>
> I tried both codes, the super::readModal() option works, but "return
> readModal()" produces the error "too few arguments, expecting at least
> 1" while opening the form in the navigator pane or during compilation.

readModal() is a built-in  method of a form object.  As one can have
many instances of a form object in memory, each, of course, with it's
own name, dBASE needs to know which instance's readModal() method you
want to execute.

If you don't use the :: scope resolution operator dBASE will execute the
named method (i.e a function)  within the calling function.

    function readModal
      //your own code
       return readModal()

effectively means the function is trying to execute itself in a never
ending loop hence the error message.

When a built-in method has been overwritten the new method (function)
needs to somehow call the built-in method otherwise the functionality of
the method is lost.  The scope resolution operator takes care of this.

return FORM::readModal() (which is the code the designer will stream out
if you overwrite a form's readModal method) or return
YOURFORMNAMEFORM::readModal()  (i.e using the actual classname of your
form) will execute the method that would have been executed if you had
not overwritten the readModal() method.  If your form has been
sub-classed from a custom form it is the custom form's readModal()
method that will be called which in turn will call the baseclass method
which actually does all the work.

return super::readModal() bypasses any underlying custom classes and
calls the built-in method() directly.

If you build your overwritten readModal() method to create a flag into a
custom class every form you build based on the custom form will inherit
that code.  If, say, for one specific form you don't want the flag
created then overwrite the readModal() method in the form but use return
super::readModal().  This will bypass the custom form and use the "plain
vanilla" version of readModal() built into dBASE.

Mervyn.