How to SetValue to *Visual_Host as field visualization
Posted: Wed Oct 12, 2022 6:36 pm
Hi All,
I am trying to change the value of all fields on a form to *NULL from the #COM_OWNER.ComponentControls property.
But, if the field's Class is a visual host, this SetValue will return False.
Is there a way for SetValue to handle the value of fields where VisualHost is used?
Below is the code for a test case form using the xEmployeeSurname field and #xEmployeeSurnameAutoComplete reusable part included in the Visual LANSA sample.
Best regards,
Taku
I am trying to change the value of all fields on a form to *NULL from the #COM_OWNER.ComponentControls property.
Code: Select all
For Each(#Element) In(#COM_OWNER.ComponentControls)
If Cond(#Element *Is #PRIM_EVP)
#STD_TEXT := (#Element *As #prim_EVP).SetValue( *NULL )
Message Msgtxt('SetValue is ' + #STD_TEXT)
Endif
Endfor
Is there a way for SetValue to handle the value of fields where VisualHost is used?
Below is the code for a test case form using the xEmployeeSurname field and #xEmployeeSurnameAutoComplete reusable part included in the Visual LANSA sample.
Code: Select all
* **************************************************
*
* COMPONENT: STD_FORM
*
* **************************************************
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(669) Clientheight(153) Componentversion(2) Left(557) Top(214)
Define_Com Class(#xEmployeeSurname.AutoComplete) Name(#xEmployeeSurname) Displayposition(1) Left(28) Parent(#COM_OWNER) Tabposition(1) Top(37)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Displayposition(2) Left(31) Parent(#COM_OWNER) Tabposition(2) Top(80) Caption('SetValue')
Define_Com Class(#PRIM_STBR) Name(#StatusBar1) Displayposition(3) Height(24) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(129) Width(669)
Evtroutine Handling(#COM_OWNER.Initialize)
#xEmployeeSurname.Value := 'Unknow Employee'
Endroutine
Evtroutine Handling(#Button1.Click)
For Each(#Element) In(#COM_OWNER.ComponentControls)
If Cond(#Element *Is #PRIM_EVP)
#STD_TEXT := (#Element *As #prim_EVP).SetValue( *NULL )
Message Msgtxt('SetValue is ' + #STD_TEXT)
Endif
Endfor
Endroutine
End_Com
Taku