jwcolby54
Member
- Local time
- Today, 12:43
- Joined
- May 19, 2025
- Messages
- 208
I use classes to generalize activities in the user interface. The objective is to standardize the interface across forms. For example every form can have an active / trash capability without having to do that in every form's code-behind-form class.
One example from my past, I used a pair of boolean fields called Active and Trash. I placed them in the vast majority of my tables. When a new record is created Active was set true and Trash is set false.
I created a class to handle this. It wrapped a pair of check boxes bound to these fields, chkActive and chkTrash. It also accepted a reference to the form so that I could sink the form's BeforeDeleteConfirm. This allows me to cancel the delete, set the trash flag and clear the active flag. The class also allows me to set the visibility of these controls true or false, thus hiding the control under most circumstances, but allowing them to be visible for a supervisor to recover deleted records.
This is a great class to earn pizza from the user.
"Sir, I am desperate. I just deleted a record i shouldn't have"
"Order a pizza and sit down, I'll fix it"
The dev asks a few questions, finds the record, which hasn't really been deleted. Brings it back to life.
The user leaves, so very grateful. Not realizing that the pizza will be delivered in a couple of moments...
Works every time!
Your thoughts?
One example from my past, I used a pair of boolean fields called Active and Trash. I placed them in the vast majority of my tables. When a new record is created Active was set true and Trash is set false.
I created a class to handle this. It wrapped a pair of check boxes bound to these fields, chkActive and chkTrash. It also accepted a reference to the form so that I could sink the form's BeforeDeleteConfirm. This allows me to cancel the delete, set the trash flag and clear the active flag. The class also allows me to set the visibility of these controls true or false, thus hiding the control under most circumstances, but allowing them to be visible for a supervisor to recover deleted records.
This is a great class to earn pizza from the user.
"Sir, I am desperate. I just deleted a record i shouldn't have"
"Order a pizza and sit down, I'll fix it"
The dev asks a few questions, finds the record, which hasn't really been deleted. Brings it back to life.
The user leaves, so very grateful. Not realizing that the pizza will be delivered in a couple of moments...

Works every time!
Your thoughts?