Show n Tell Friday
Okay, I'm a day late, but here's my SnTT
for the week, as promised.
(Again, none of this has to do with reality.)
I showed last week how I was using layers to show embedded elements as floating objects. Now I've added a capability to my previous treatment to reveal a preview pane of the prior visit by the patient.
UPDATE: Props to my colleague Colin Macdonald for working out the "grab the container UI" stuff you'll see after the jump!
(Again, none of this has to do with reality.)
I showed last week how I was using layers to show embedded elements as floating objects. Now I've added a capability to my previous treatment to reveal a preview pane of the prior visit by the patient.
UPDATE: Props to my colleague Colin Macdonald for working out the "grab the container UI" stuff you'll see after the jump!
Hopefully everyone knows how to link an embedded view to an embedded editor, but in case you don't, you just add a view, add an editor, name the editor something like "Preview" and then point the embedded view to open in "Preview" on single/double click.
The thing that makes this interesting is that the trigger is to double-click on the document in the embedded view. But if you think about it, that's a problem, because you want to have an event firing in the embedded view (QueryOpenDocument) reveal a layer in the containing UI document. It turns out that this isn't so tough, but fits in with a little known differentiation between NotesUIWorkspace.CurrentDocument and the Source parameter you get on all your various view/form events. Whether in a regular form, dialog box, or embedded editor, "Source" always refers to the firing UIdocument. BUT, NotesUIWorkspace refers to the primary ui document in the current window. So if you're in a dialog box, it's the underlying document screen that you might have had open when you called the box. If it's an embedded editor, it's the containing ui document context. This also goes for views.
So, my embedded view has a simple QueryOpenDocument that includes...
Dim containerUI as NotesUIDocument
Set containerUI = wrkSpc.currentDocument
containerUI.document.tmpBackgroundPreview = "Show"
Call containerUI.refreshHideFormulas
Continue = False
Safety tip: Don't EVER call containerUI.ViewRefreshFields. It's a nice red box. (And I'm lying... the event contains a lot more than that, but it's what's necessarily for this demonstration, but you get the point.)
The layer, of course, then reveals itself.
Now, another interesting thing is that the layer anchor itself is actually just below the embedded view. Normally, that would mean that my window would open way off to the right. BUT, it turns out that layer positioning in the Notes clients respects negative offsets. So in this case, I set my Left offset to -158 Percent, and the whole thing shifts nicely off to the left. If you choose to try this technique, adjust until it looks right to you. If you specify the embedded editor as the proper form, you'll be able to do this fairly easily in designer.
You might note that my preview window itself has embedded views. Wheels within wheels, huh?


Comments
Nice article. Can you please explain how did you hide the layers and where did you write the code to hide/unhide the layers.
Thanks
Ram
Posted by ram At 11:38:49 PM On 07/21/2006 |
Cheers
D:)
Posted by Darren Oliver At 01:56:49 AM On 06/28/2006 |
Of course, like the previous show-and-tell this is up there.
Posted by Slawek Rogulski At 01:29:41 AM On 07/08/2006 |