Morph/Unmorph Events for Data Bound Controls
Posted: Fri Jan 10, 2020 3:00 pm
Hi
I do not know if you already have this feature but in my framework I does not use VFP's built in data binding. Instead I created a GetData() and SetData() methods for all my data bound controls. The GetData() method read the bound field data from the table. As part of the process it passed the data to the Morph() method which allowed me to modify the data before it was sent to the control. This is a very powerful way to modify data that will be displayed in the control as well as executing other functions such a decrypting data, hiding controls based on the value found in the table etc. The Unmorph() is used to convert the control value back to what should be stored in the table. The code below gives the basic idea where "This" is the data bound control.
I do not know if you already have this feature but in my framework I does not use VFP's built in data binding. Instead I created a GetData() and SetData() methods for all my data bound controls. The GetData() method read the bound field data from the table. As part of the process it passed the data to the Morph() method which allowed me to modify the data before it was sent to the control. This is a very powerful way to modify data that will be displayed in the control as well as executing other functions such a decrypting data, hiding controls based on the value found in the table etc. The Unmorph() is used to convert the control value back to what should be stored in the table. The code below gives the basic idea where "This" is the data bound control.
Code: Select all
This.Value = This.GetData(This.ControlSource)
Procedure GetData(teVal)
....
Return This.Morph(teVal)
EndProc
Procedure Morph(teVal)
...
Return teVal)
EndProc