Not too long ago I wrote an article on generically setting a Form as read-only on slxdeveloper.com. Mike Spragg from E1 Business shared a great approach with me to accomplish the same with legacy views.
What Mike does is run a script that establishes all the objects on the form – and then set them to disabled. That way, you retain the cut/paste info & linkedit’s (urls’ etc):
Dim ObjectName As String Dim enabled As Boolean Dim t As Integer Dim IDList As String Dim IDExclude As String enabled = False IDList = CurrentObjectChildrenNames IDExclude = "Panel4btMatchBevelPanel1Panel2Panel3Panel4PanelimLockButton" For t = 0 To GetLineCount(IDList) - 1 Objectname = GetNthLine(IDList, t) If instr(1, IDExclude, ObjectName) <= 0 Then SetPropertyOf ObjectName, "Enabled", enabled End If Next t
This is, obviously, legacy – but same idea for active forms
IDList = list of all objects on the form
IDExclude = Any you don’t want to protect
That is an awesome approach. Thanks Mike! For anyone still working with legacy (I feel for you) this is a great way to accomplish this.