Wednesday, November 18, 2009

Sweet Drag and Drop Actions In the Lotus Notes Client

I've mentioned once or twice before that I really like using drag and drop. Although it is often a bit slower than other actions and you sometimes have to show the user how to do it, I find it to be a preferred method for executing certain tasks in an application. Lotus Notes itself offers many cool and useful drag and drop actions. I've been showing end users some of these for a long time, and always there are folks that had no clue drag and drop actions were even available. I wanted to share a few of them with you now.

Drag & Drop Links

You can drag and drop a document from any Notes view or a database icon into a rich-text field and Notes will create a document link or database link (as applicable). If the document is open, you can actually perform the drag and drop action from the tab. This is a much easier way to teach users how to send links to documents.

A couple of hints: You can often drag information from one part of Notes into another by hovering over the appropriate tab. For example, click and hold the tab of an open document, then drag it over to the tab of a document in edit mode. Hold it there for a second and the focus will change to the new document. You can then perform the drop action into a rich-text field and the link will be created. Also, an easy way to get the Notes:// address of an element is to perform that drag and drop into a regular text field. This will give you the Notes:// link along with the title of the item.

Drag & Drop Attachments

You can take attachments from a Notes document and drag them to the file system or your Windows desktop. For those of you on Notes 8, check out the very cool File Navigator side shelf component on OpenNTF. You can use this to drag and drop files directly from your Notes client!

Drag & Drop To/From Sametime

With Notes 8.5, you can drag a mail message to the Sametime Contacts list. When you drop it, a dialog will appear and present you with a list of all recipients of that e-mail message. You can choose to add them all or just select individuals to your contacts. This is a very speedy way to create groups within Sametime.

Going the reverse direction, you can drag a single contact or a group name from your Sametime Contacts list into the address fields of a new memo to instantly add those recipients to the mail message.

If you drag and drop a contact into a rich-text field, a mailto link to that individual will be created.

Drag & Drop Text

With Notes 8.5, users can now have a more rich experience as they drag & drop text. You can drag and drop text within a rich-text field (useful for rearranging some paragraphs, for example) or even between rich-text fields. I'll often use this when I am creating a new calendar entry and I want to pull some information out of an existing doc. Sure copy and paste is a bit faster, but drag and drop is so fun! ;-)

Drag & Drop Tabs

I often work with several documents and views open at one time and I generally like to have an orderly flow to how the tabs are arranged. If I open up these elements in an order other than the way I like them arranged, I just grab the tabs and reorder them via drag & drop. Perfect.

Drag & Drop Table Controls

There are some long awaited functions now available for manipulating tables via drag & drop. One of the best is the ability to resize columns without using the ruler. With Notes 8.5.1, you just grab the column border and drag & drop to resize.

You can also move whole rows or columns at one time via drag & drop. If you hover over the outside border of a row or column, you'll see the cursor change to an arrow pointing at a row or column respectively. Click, hold and drag and you'll see a shadow moving to represent that row/column. Drop it where you want it in the table and the other elements will be reordered accordingly (see animation below).

If you just want to move the content of a single cell, highlight it and then drag & drop it into the destination cell of choice. You can move multiple cells at once, as well. Play around with this a bit and you'll find some interesting functions.

While I'm on the subject of tables, while not strictly drag & drop specific, there are a couple of other very handy new tricks you might like. If you want to add a new row or column, you can now do this without resorting to the Table menu. To do this, hold the Shift key down and then hover over a row/column border. You'll see the cursor change to a thick horizontal or vertical line with a little blue diamond next to it. When you see this cursor, double click with your mouse and the new row/column will be inserted. Thanks to the developers...I really like that new edition!

So, those are some of my favorite drag & drop features in the Notes client. There are many more. How about you? Any particular drag & drop actions I missed that you really like? If so, please share in the comments.

Labels: , , ,

permalink | leave a comment

Friday, December 14, 2007

Drag & Drop From One Database To Another

I recently had someone ask me a question about some of the drag and drop techniques I use in my applications. One of the questions was whether or not you could drag and drop between databases. I can't recall ever having done that before, but with a little clever coding, it can be achieved. Here's how:

To accomplish this, I actually use the same technique that you may have seen in the presentation Nathan and I gave at Lotusphere last year.

The first step is to create a new folder that will serve as the target for the drag and drop action. The design of this folder doesn't really matter unless you want to use it as a folder in your source database. Once your folder is created, you want to add an entry for the folder on either an existing outline or create a new one. In the outline, reference the folder and add an icon if desired.

In order to get the documents being dragged from the source database to the target database, it is necessary to add code to the Queryaddtofolder event of the view/folder in which the document originally resides (not the one you are dragging it to). This code will perform the work of copying the source document to the destination database. Of course, there's lots of flexibility with how you could write this code (and it's probably best to throw it into a script library and use it in the views/folders you need it), but here's a sample I put into my mail file.

Sub Queryaddtofolder(Source As Notesuiview, Target As Variant, Continue As Variant)

'Here you could branch code based on the target folder.
'In my case, I don't want anything special to happen unless I'm dragging to the "DragTarget" folder.
If Target <> "DragTarget" Then Exit Sub

'In the case of my mail file, I don't want any docs actually going into this folder, so we'll set Continue to false, which will prevent this.
Continue = False

Dim session As New NotesSession
Dim collection As NotesDocumentCollection 'The documents selected (i.e. being dragged)
Dim doc As NotesDocument 'The doc in the source database
Dim newDoc As NotesDocument 'The doc in the target database

'Hardcoding is bad...don't do it! :-)
Dim targetDB As New NotesDatabase ( "", "mail1\gtd.nsf" )

'Get the collection of docs selected and iterate through...sending them to the target db and moving them to the appropriate folder
Set collection = Source.Documents
Set doc = collection.GetFirstDocument

Do While Not (doc Is Nothing)
Set newDoc= doc.CopyToDatabase( targetDB )
Call newDoc.PutInFolder("($Inbox)")
Set doc = collection.GetNextDocument(doc)

End Sub

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at

This is a look at the implementation from my mail file. I have another database where I keep my to do lists. Often, an e-mail initiates some kind of action on my part, so rather than copying and pasting from my mail file to my Task database, I can just use the drag and drop feature. This is how it appears in Notes 8 integrated into the new look and feel. (Nothing exciting...looks like it's just part of the interface...which is what I wanted)

I made it look a little different in Notes 7 by using a bigger graphic to serve as the drop target. Again, this is just an outline embedded on a page, so you could use any kind of graphic you want.

Pretty handy and easy to implement as well. Enjoy!

Labels: , ,

permalink | leave a comment