Hosted By

Subscribe to keithstric.com

Misc Links

Domino 7 OpenNTF BlogSphere CoComment Custom Button

Lotus Notes Blog Search

OpenNTF

Disclaimer

The opinions and ideas posted on keithstric.com are not necessarily the opinions and ideas of my employer. The solutions, techniques and code provided here are not guaranteed or warranted in any way and are free for you to use at your own risk.

« Changing Jobs... | Main| Happy Yellow Day!!! »

Field Class frustrations

Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

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

Gravatar Image1 - Hrmmm... it hackalicious, but...

(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.

Gravatar Image2 - Oh... echoFieldName is just...

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.

Gravatar Image3 - I went down this path when I ended up in the event binding issue Tim was having. I had coded it all up to the point Tim was at before I ran it. It took me a while to track down the fact that you can't bind field events from a LS class, then I discovered the overriding issue after more hacking around.

@Nathan - Going around your ass TWICE to get to your elbow? I'd call that craptacular rather than hackalicious. Emoticon I hadn't considered dumping the form to DXL and parsing through it to insert the field-level code. It should round-trip okay unless your form is complicated. There may be something there, but it sounds like a lot more work than it's really worth. These are the kinds of thing that should be easy. I've been doing it in MS Access for about 13 years.

Post A Comment

:-D:-o:-p:-(:-):-\:-|:angry::cool::cry::dontknow::emb::hairout::laugh::rolleyes::whew:;-)