Bring tab to front on Workspace

Hello -

I was wondering if there was any way programatically to bring focus to an open tab on the Workspace.  

Let's say I have a "Projects" database open.  I have it open to a form which contains an embedded view.  This view shows all of my assigned tasks.  Now I get an email with a link to this same form because a new task was assigned to me.  If I forget I have the db open and click the link in the email I would like the open form to come to the forefront.  


Thanks!
KDragoAsked:
Who is Participating?
 
mbonaciCommented:
KDrago,
code example:
The code works as though Alt + Tab has been pressed (switches to the first window on the right in the Alt+tab order):

Const KEYEVENTF_KEYUP = &H2
Const VK_MENU = &H12
Const VK_TAB = &H9
Declare Sub KeyPress Lib "USER32" Alias "keybd_event" ( Byval V As Integer, Byval S As Integer, Byval F As Integer, Byval E As Integer )

Sub Postopen(Source As Notesuidocument)
    If Source.Document.HasEmbedded Then
        KeyPress VK_MENU, 56, 0, 0
        KeyPress VK_TAB, 15, 0, 0
        KeyPress VK_TAB, 15, KEYEVENTF_KEYUP, 0
        KeyPress VK_MENU, 56, KEYEVENTF_KEYUP, 0
    End If
End Sub

Hope this helps,
Marko
0
 
KDragoAuthor Commented:
I should add that we've been able to prevent the database from opening again - catching it in the postopen event, but cannot figure out how to bring the tab containing the open form to the forefront.
0
 
mbonaciCommented:
Hi KDrago,
I think there's no way to do that using Lotus Script or C/C++ API (only backend).

You can try with key press simulations (using Ctrl + Tab to switch tabs of workspace).

Hope this helps,
Marko
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
HappyFunBallCommented:
I didn't realize that was the default behavior in Notes but I just tried it and I see what you mean.  That seems silly to me.

Anyway, I'm pretty sure you'll be able to do this using the EditDocument method in Lotusscript.  See the designer documentation.  There is a parameter called newInstance (R6 and above only) that will tell the code to try to open an existing instance of the document.

0
 
mbonaciCommented:
KDrago,
I ment you need to switch workspace tabs, not document tabs (but, by mistake, told you correctly what the keyboard shortcut is).


Marko
0
 
mbonaciCommented:
KDrago,
and yes, CTRL is &H11

Hope this helps,
Marko
0
 
marilyngCommented:
Uh, I can be wrong:  >>If I forget I have the db open and click the link in the email I would like the open form to come to the forefront.  
<<  what is formatting the link?  Geeez... let's create LOTS OF CODE instead of fixing the link!!!! :))

If you send a regular link, you can add target="_SELF", etc. to the link if it's a web link.  Normally, these links are constructed for both Notes and WEB

Web side is easy, add a target.

Notes side, well, instead of URL + Notes link, maybe send BUTTON (such a concept) that, as Happy says, doesn't open a new instance.

So, decide in your application how you want the link to arrive.  If you want it to open in the same instance of a window already open, then you're going to have to send both a URL and a button -- one for web, another for client.

make sense?
0
 
KDragoAuthor Commented:
I apologize for the delay...just returned to this now.  Thanks for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.