Field Class frustrations
After reading the Event Binding series over on Tim Tripcony 's website I found something useful for the DominoField Class that I wrote about a while back.
The idea was if I could get a handle on the Field class for a particular field I could run a postopen event of a document, collect all the fields as an instance of the DominoField class in the array and then define my own events or extend the built in events for each field on the document. I could then define some form of validation or have an event for each field on the form which would then make the DominoField class useful. Unfortunately I can't find any way of getting a handle to the field class, I guess I could go to each field on the document and in the entering event pass "Source" as a parameter of the DominoField class but that kind-of defeats the purpose.
Maybe some of you might have an idea of how to get around this, as it's very frustrating.











Comments
(Globals)
Dim curUI As NotesUIDocument
Dim fieldObjs List As Field
Then in the form...
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Set curUI = source
End Sub
In any given field...
Sub Onfocus(Source As Field)
Set fieldObjs (curUI.currentField) = source
End Sub
Then on the form...
Sub Postopen(Source As Notesuidocument)
Dim lastField As String
Dim curField As String
lastField = curUI.currentField
Do Until lastField = curField
lastField = source.currentField
Call source.gotoNextField
curField = source.currentField
Loop
Call source.gotoTop
Forall uiField In fieldObjs
Dim curFieldObj As Field
Set curFieldObj = fieldObjs(Listtag(uiField))
On Event Exiting From curFieldObj Call echoFieldName
End Forall
End Sub
That does work. I suppose you could inject the Onfocus code via DXL.
It'd be really cool if you could do it via the field's Initialize, but that event doesn't have a source.
Let me know if you come up with some place useful to go from here.
Posted by Nathan T. Freeman At 05:08:32 PM On 08/01/2008 | - Website - |
Sub echoFieldName (Source As Field)
Print "leaving: " + curUI.currentField
End Sub
It's not 100% accurate, because currentField is the one you're arriving in, but it would be a relatively small matter to bind to Entering & Exiting to track cursor movement.
Posted by Nathan T. Freeman At 05:10:43 PM On 08/01/2008 | - Website - |
@Nathan - Going around your ass TWICE to get to your elbow? I'd call that craptacular rather than hackalicious.
Posted by Charles Robinson At 12:27:22 AM On 08/03/2008 | - Website - |