Friday, December 15, 2006

Quick Tip: Images In Views

File this one under "stuff I thought everyone knew, but turns out some people missed it". With all the talk about the new view icons over on Mary Beth Raven's blog (and subsequent spillover to Nathan's), it reminded me that I wanted to do a short post about using your own custom icons in a Notes view. I often make my own view icons so that the context more closely represents what my application is all about. At the Lotus Developer2006 conference in Vienna, I showed a demo database that happened to make use of this idea. I didn't address the technique, nor did I mention anything about the view icons, but I was actually asked on three separate occasions during the conference how I "got those icons in the view". Thus, today's Quick Tip is how to do just that. Luckily, it couldn't be easier, which makes for a nice Friday post! :-)

To use your own custom view icons, you need to drop the icons you want to use into the database's Image Resource section. Once your icons are there, create your view column and set the property to "Display values as icons", Now here's the trick...instead of referencing a number (which allows you to use the built-in Notes icons), simply enter the name of an icon in your Image Resource section (e.g. "newdoc.gif"). Of course, usually you'll want to use a formula to calculate this. Perhaps you have different status icons that represent the state of a document. Just setup the column as you always do and reference the image names rather than the numbers and you're good to go. Another nice thing about using this technique is that the name that you give the image resource will be shown to the user when they mouse over the icon. Thus, you could write some nice descriptive text such as "This document is ready for review".

Creating your own icons is cool, since there are some neat things you can do. Here's an example of an embedded view that has CD images. It's in a form with an embedded editor, so that when the user selects the document, they also see the track listing without actually having to open the document.




If you get creative, you can really extend these ideas to make some powerful apps. For example, you could allow the user to attach a file that would be used as the view icon for a document and then you could have code to extract the attachment and automatically make it an image resource so it could be shown in the view (several folks have done this with DXL...a quick search should turn some up).

Well...I hope you all have a great weekend. Cheers!

6 comments:

Chris Whisonant said...

Symphony X - NICE!! :) Good music - I dig Angra too...

Nathan T. Freeman said...

Ooh, you're going to have to show me how you generated that view. The image I get, but that multi-line trick is... well... I don't even know!

Chris Blatnick said...

@Chris: Oh yeah...I'm a big Sym X fan and Angra is one of my top five favorite groups. I got to see them in a bar in Cleveland after ProgPower III. They decided to do a mini-tour (about 5 shows) but no one knew about it. There were maybe 20 people in the place and they played like they were doing a packed arena. Very cool guys!

Chris Whisonant said...

Wow, I bet the show was amazing. Just threw on some Sym X before my meeting!

By the way, I'm with Nathan - great view. Are you gonna give us some info on the "multi-line trick"? :)

dogu said...

Chris,

What Nathan and Chris said...Form with an embedded view with an embedded editor, with track listings...???

I'm gonna go play, but any tips or hints would be great.

Doug

dogu said...

Got it, your hints (plus help) were enough. It's just like you said, a form with an embedded editor and and embedded view (in that order) that uses the editor - how very clever and very cool! Thanks for the post.