« Pet Peeve | Main| JSFactory »

SnTT: clickable URL's in a view column... in the Notes client

Category show-n-tell thursday
Bruce just pinged me with a dilemma: he wanted a way to to make URL's clickable when displayed in a view column from within the Notes client. I wracked my brain momentarily, and the only idea I could come up with was using the Inviewedit trick that I first saw Chris Blatnick allude to in his CoolMail demo (explained later in greater detail). This isn't ideal, of course, as that technique requires that you click an icon column - perhaps immediately adjacent to the URL - not the URL itself...

...or does it? One of the parameters included in the Inviewedit event is Continue, something we're typically used to toggling in other events to prevent that event from completing. For example, you might perform some validation in the QuerySave and toggle Continue to False if the validation fails, or toggle it to False in the QueryOpen if you want to load a DialogBox when the user tries to open the document using the standard form. So what happens if Continue is False in the Inviewedit? Even if the column in question is a standard text column (in other words, not displayed as an icon), if Continue is immediately toggled to False, the column never becomes editable! But the event has already been triggered, so you can still determine the row that was clicked (via Source.CaretNoteID), and can therefore get a handle on the document, retrieve the URL, and navigate to it. Voila:

Let Continue = False
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim dbCurrent As NotesDatabase
Dim docSelected As NotesDocument
    
Set dbCurrent = session.CurrentDatabase
Set docSelected = dbCurrent.GetDocumentByID(Source.CaretNoteID)
Call workspace.URLOpen(docSelected.GetItemValue("URL")(0))



(cross-posted at BleedYellow)

Comments

Gravatar Image1 - This tip is great - I had tried using text but didn't want the users to change it, and hadn't got as far as setting Continue to False.

The biggest problem I have is that (in Notes 7 at least - haven't tried it in 8) the user often has to click twice on the row to get the event to fire - once to move the caret to the target document, then again to fire the event.

Gravatar Image2 - I've just tried this out and the other problem is that setting Continue to False causes Notes to play the windows 'Asterisk' sound.

This is sooooooo close to what I want it to do.

Gravatar Image3 - Curses... I didn't notice that before, because one of the first things I always do on any new Windows machine is set the sound scheme to "No Sounds" (I just find it so distracting to have everything I do make noise), but I enabled an Asterisk sound and tested again, and you're right: click, DING! So annoying. Does it do that on other "Continueful" events too, I wonder?

Gravatar Image4 - Using a field named "URL" is not a good idea if you want to use the form for web too. Emoticon

Gravatar Image5 - @Ingo, any particular reason? Can't recall encountering any problems with that in the past...

Gravatar Image6 - Using a field named Url with prevent some copy & paste actions in the client (it will paste the content of the Url field instead). That can be quite annoying sometimes.

Gravatar Image7 - And now I remember when this happens. When you try to create doclinks within the client it will paste the content of the Url field instead of a doclink. Sorry for the double post.

Gravatar Image8 - Oops, I was on the wrong track. It's not a web problem but a problem in the Notes client. Sorry.

Thanks Henning.


Gravatar Image9 - @Henning/Ingo, good to know... I hadn't heard that before, but just verified it.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Contact Me

Hire Me

Elsewhere

What the Quote?

"I've always wanted to say, 'Paris is burning", and have it be true."

Jennifer Holland

"King Tut is buried in my nose."

Laura Hearron

"It'll be 'The Summer of Jane'. Somehow, 'The Fall of Jane' just doesn't have the same ring to it."

Jane Cook

"Dance, my puppets!!! DANCE!!!"

Nathan Freeman

"The best thing about Boolean is, even if you're wrong, you're only off by a bit."

John Jaeckle

Apparel

Lotus Rocks

I write the code that makes the young girls cry

Current Terror Alert Level

Assorted Linkage

ClustrMap