API
@-Formulas
JavaScript
LotusScript
Reg Exp
Web Design
Notes Client
XPages
 
Show Search Bar In Framed Environment
We recently ran into an interesting problem. We were creating a Notes-only application. It seems like all the time now we have a frameset with a page on the left and a view on the right for these Notes-only applications. There were a bunch of action buttons in the view, and the customer wanted to add two new ones - one to show the search bar and another to hide the search bar. Since the view action button was already pretty full, the customer agreed to put those two buttons into the page in the left frame. But then the problem appeared - how do you show or hide the search bar in one frame through a button on another frame?

Obviously, a button in the left frame with @Command([ViewShowSearchBar]; "1") would work in the left frame instead of the right frame. So the next thing to try is setting the target frame before showing the search bar:

@SetTargetFrame("Right");
@Command([ViewShowSearchBar]; "1")

But this gives an error of Cannot execute the specified command.

As it turns out, there's only certain @Commands that can be executed right after @SetTargetFrame. These are documented in the help, but I'll list them here:
@Command([Compose])
@Command([EditDocument])
@Command([OpenFrameset])
@Command([OpenPage])
@Command([OpenView])
@Command([RefreshFrame])

Hey, @Command([OpenView]) is on the list. So, all we have to do is open the view, then we can turn the search bar on. So our button code now becomes:

@SetTargetFrame("Right");
@Command([OpenView]; "The View");
@Command([ViewShowSearchBar]; "1")

(The code to hide the search bar is the same except for "0" in the last statement instead of "1").

This works like a charm. Even if your view is set to open to the top row or the bottom row (view properties, second tab, "on open" value) instead of opening the last document, the Notes client is smart enough to know what you're trying to do. It will keep the current document highlighted in the view and simply show (or hide) the search bar. Nice.