On Feb 22, 2019, at 8:43 AM, Kirk Brooks wrote:
> 2) if you need DIALOG just wrap it in another object. I like to use 'data'.
> So you can do this:
>
> $obj:=New object("data";$oChildObject)
>
> DIALOG("myForm";$obj)
>
> It's simple to change the references on the form objects to
> Form.data.whatever. I find it more robust not the least of which because it
> allows you to have a null object without crashing your form.
I ran into something related to this. If you just want to return data in the
“Form” object — you are not passing any data into the form — you must create
the object before you call DIALOG.
So this fails:
C_OBJECT($formData_o)
DIALOG(“myForm”;$formData_o) // somewhere on myForm you do this
“Form.result:=“Continue”
// get values set in the myForm that were assigned to “Form” object
if($formData_o.result=“Continue”)
// this never executes
end if
But this works:
C_OBJECT($formData_o)
$formData_o:=New object
DIALOG(“myForm”;$formData_o) // somewhere on myForm you do this
“Form.result:=“Continue”
// get values set in the myForm that were assigned to “Form” object
if($formData_o.result=“Continue”)
// this never executes
end if
$formData_o now has all the properties you set in myForm assigned to “Form”
object. Like “Form.result:=“Continue”
You have to get $formData_o instantiated — if that’s the right word — in the
method before you pass it into the DIALOG command because it is passed by
reference. Then when you use the “Form” function in myForm it will update the
correct object that you created with the "$formData_o:=New object” line of
code.
Tim
*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
[email protected]
*****************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************