*OBJECT Get pointer*(Object named;"")

does return the Form object.

If you standardise your naming convention of the form field objects you
could determine the sub object and attribute you're looking for.

example:

FormObj_Wrap_Trim("en_company";"name")


FormObj_Wrap_Trim:

$vT_Object:=*$1*

$vT_Attrib:=*$2*

$vT_FormObjName:=$vT_Object+"_"+$vT_Attrib

$vP_Field:=*OBJECT Get pointer*(Object named;$vT_FormObjName)

Trim($vP_Field->[$vT_Object][$vT_Attrib])

this will get you Form.en_company.name

As I don't know what you have in Trim I'll just leave it as is.

Adam Bevan




On Wed, 29 Apr 2020 at 15:53, Chris Belanger via 4D_Tech <
[email protected]> wrote:

> Generic programming of vars on a form is very complicated when one uses
> object attributes for the data source.
>
> For example, on screen you make a simple text input object named
> “enCompany”. It’s data source is Form.en_Company.Name (  i.e.
> [Company]Name  )
>
> In ‘classic 4d”, where the data source would be [Company]Name, one can
> code its script:
> TRIM ( Self )
>
> And TRIM would simply take a POINTER, and you can perform operations on
> the data that the user typed into that field. (Such as trim off leading &
> trailing spaces).
>
> But with OBJECT NOTATION, that is all screwed up.
> You cannot get a PTR to, for instance, an object named ‘enCompany’ whose
> data source is  Form.en_Company.Name
> So the script for it cannot be generic.
> It would seem to make sense to be able to do something like:
>
> TRIM ( Form Event.objectName ) — and have some way to actually do anything
> with what the user typed into this element on-screen.
>
> You can’t use TRIM ( Self ) because Self is nil
>
> And v18r3 does not even have a solution to this in its documentation.
>
> It seems we should have some way of getting the user-input data of a
> screen element even if we are using object notation.
>
> We would expect, at the least, something like  OBJECT Get Value (
> ObjectName ) and OBJECT Set Value ( Object Name ) but no!
>
> Any input? Wait for version 20 of 4D?
>
> - Chris
> **********************************************************************
> 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]
> **********************************************************************
**********************************************************************
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]
**********************************************************************

Reply via email to