A method to process input before validation
A massage func allows for data entered by user into a column in a Womb.Gtk.AtomTab to be processed and modified before being validated and inserted into the database.
You can use a massage func to automatically remove forbidden characters, or generate content automatically from combination of fields, or whatever your application needs.
A massage func must be able to deal with null input (usually returning null) and throw no exceptions during processing.
Example of massage func:
C# Example |
using System; using Gtk; using Womb; using Womb.Gtk; void CreateView (DB db) { Employee emp; AtomTab tab; emp = new Employee (db); tab = new AtomTab (emp, true); // Set a data massage func in the surname column tab ["surname"].MassageFunc = SurnameMassage; tab.Refresh (); } string SurnameMassage (Atom atom, string data) { Employee emp; // Example of massage: // make surname uppercase emp = (Employee) atom; if (data == null) return null; else return data.ToUpper (); } |