Morph/Unmorph Events for Data Bound Controls

Have some feedback and input to share?
Don't be shy and drop us a note. We want to hear from you and strive to make our site better and more user friendly for our guests and members a like.
Post Reply
Posts: 1
Joined: Fri Jan 10, 2020 2:45 pm

Morph/Unmorph Events for Data Bound Controls

Post by dCipher »


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)
   Procedure Morph(teVal)
      Return teVal)
Post Reply