NotesUIWorkspace properties is goofy. Can anyone explain?

Why aren’t all the properties for NotesUIWorkspace set when code executes in a database?

For example, I am working a solution to a problem where the user has a database open, a view open, and an open document immediately in the user’s interface (meaning its the currently active document in its own window). If I execute some code from this document, and use the debugger to examine the execution, NotesUIWorkspace only defines the .CurrentDocument property. It doesn’t define the other 3 properties:

.CurrentDatabase or

.CurrentView or

.CurrentCalendarDateTime

That just doesn’t make any sense to me. I mean, at minimum, wouldn’t you think the CurrentDatabase be set correctly since its document is open? I’d really like to use the NotesUIDatabase object in this context, but I can’t because of this obstacle.

Can anyone shed some light on this? Thanks in advance.

-RAM

Subject: NotesUIWorkspace properties is goofy. Can anyone explain?

I am opening a view using openView in LS. I need the handle to this newly opened view. but using workspace.currentView, I get the handle of previously opened view instead of the new one. Any suggestions ?

Subject: NotesUIWorkspace properties is goofy. Can anyone explain?

Part of your problem, I suspect, is that only one object can be “current” at any given time. Only the top-most object, the one staring the user in the face (not just anything that happens to have a tab open) is current. If, for example, there’s a document open in the foreground, there’s no CurrentView. A view has to be open in the foreground for there to be a CurrentView, in which case there can’t be a CurrentDocument. CurrentCalendarDateTime only exists when a calendar view is open in the foreground. As for CurrentDatabase…well, I don’t have a complete explanation, but apparently it has issues under certain circumstances, so you should use GetCurrentDatabase instead.

Subject: RE: NotesUIWorkspace properties is goofy. Can anyone explain?

Thanks to both of you for straightening me out. Your explanations make a lot sense.

I worked with the .GetCurrentDatabase method earlier today, and am starting to understand how that fits in as well. I’ve noticed that when I use the .GetCurrentDatabase during a LotusScript’s routine, the “current database” can change during the life of the script execution, depending on how many databases are being manipulated and how they’re used. It does seem more reliable for getting a handle on a NotesUIDatabase.

Thanks again for the help.

-RAM

Subject: NotesUIWorkspace properties is goofy. Can anyone explain?

Sure … those are the properties to access whatever object is “current” to the user - there can be only one Current object at a time.

Remember that the user could have 5 views, 16 documents, and 3 calendars “open” at once. There will be only one Current propery set, and that’s the one the user is working with.

The current database (i.e. The database that the current object belongs to) can be found with the GetCurrentDatabase method of the UI workspace. Indeed, Notes 6 help points out the this method superseeds the CurrentDatabase propery.