@command([compose];...) in frame gives no focus

I have a database that opens to a frameset with two frames “A” “B”.“A” contains an outline while views end documents are opened in “B”.

Forms have the auto frame property set to open in “B”.

Everything runs fine but when we create a new document using @command([compose];…) there is no focus on any field on the form: we have to click and then the cursor shows up in the first input field.

Is this working as designed and what can I do to skip the clicking ?

Subject: you have to tell it to change the focus

@SetTargetFrame(“B”);@UpdateFormulaContext;

@Command([EditGotoField]; “fieldname”)

Subject: Focus on form in frame B

You’re right, the form has not the focus. I met this issue trying to collapse an embedded view in a form opened in another frame.The workaround I found was to move the focus to the right frame using sendkeys (the F6 key moves from one frame to anothe).

Thierry Cayla

http://dominoeffects.serveblog.net

Subject: it works as designed

I understand that it works as designed and you must rely on OS dependant APIs to move the focus on the just opened form.Nice to know.

Subject: how did you use SendKeys?

It’s not supported in LotusScript. Did you use the Windows API call?

Subject: Sendkeys for F6

Declare Sub keybd_event Lib “user32.dll” (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)

keybd_event &h75,0,0,0 'F6 key down

keybd_event &h75,0,2,0 'F6 key up

Thierry Cayla

http://dominoeffects.serveblog.net

Subject: okay, that’s what I do, too

Either keybd_event or SendKeys API calls. It’s stupid that the Designer help shows SendKeys, but it’s not supported in Notes.

Subject: SendKeys for F6 - Where did you get syntax?

I’m trying to have users click on a Action Button to automatically set the margins in order for a delicate form to print entirely on 1 page.

After hours and hours of effort, I realized I can’t get the FULL FILE MENU to appear.

While viewing the doc, manually do a “ALT+F”, you get 19 FILE MENU options. When I try to use my Action Button, the ALT+F script code only produces a subset FILE MENU of about 9 items to choose from, and PAGE SETUP isn’t one of them, and so then for some reason it tries to execute the first menu option “MESSAGE” and hangs there.

I’m using IBM DOMINO DESIGNER 9.0 on Windows 10 Enterprise.

I tried this in 2 different ways using keybd_event and SendKeys - the code for both Action Buttons are detailed below.

If anyone can get this to work, I’d appreciate some help. Thank you very much in advance for your time and assistance.


USING keybd_event:

DECLARATIONS:

Declare Sub keybd_event Lib “user32.dll” (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)

CLICK:

Sub Click(Source As Button)

keybd_event &h12,0,0,0 ' Alt key down

keybd_event &h46,0,0,0 ' F key down

keybd_event &h46,0,2,0 ' F key up

keybd_event &h12,0,2,0 ' Alt key up

keybd_event &h47,0,0,0 ' G key down

keybd_event &h42,0,2,0 ' G key up

'set Above Header to .25

keybd_event &h6e,0,0,0 ' . key down

keybd_event &h6e,0,2,0 ' . key up

keybd_event &h62,0,0,0 ' 2 key down

keybd_event &h62,0,2,0 ' 2 key up

keybd_event &h65,0,0,0 ' 5 key down

keybd_event &h65,0,2,0 ' 5 key up

'move

keybd_event &h09,0,0,0 ' Tab key down

keybd_event &h09,0,2,0 ' Tab key Up

'set Above Body to .25

keybd_event &h6e,0,0,0 ' . key down

keybd_event &h6e,0,2,0 ' . key up

keybd_event &h62,0,0,0 ' 2 key down

keybd_event &h62,0,2,0 ' 2 key up

keybd_event &h65,0,0,0 ' 5 key down

keybd_event &h65,0,2,0 ' 5 key up

'move

keybd_event &h09,0,0,0 ' Tab key down

keybd_event &h09,0,2,0 ' Tab key Up

'set Below Body to .25

keybd_event &h6e,0,0,0 ' . key down

keybd_event &h6e,0,2,0 ' . key up

keybd_event &h62,0,0,0 ' 2 key down

keybd_event &h62,0,2,0 ' 2 key up

keybd_event &h65,0,0,0 ' 5 key down

keybd_event &h65,0,2,0 ' 5 key up

'move

keybd_event &h09,0,0,0 ' Tab key down

keybd_event &h09,0,2,0 ' Tab key Up

'set Below Footer to .25

keybd_event &h6e,0,0,0 ' . key down

keybd_event &h6e,0,2,0 ' . key up

keybd_event &h62,0,0,0 ' 2 key down

keybd_event &h62,0,2,0 ' 2 key up

keybd_event &h65,0,0,0 ' 5 key down

keybd_event &h65,0,2,0 ' 5 key up

'Enter to close dialog box

keybd_event &h0d,0,0,0 ' Enter key down

keybd_event &h0d,0,2,0 ' Enter key up 	

End Sub


USING SENDKEYS:

DECLARATIONS:

Dim WshShell As Variant

Dim i As Integer

CLICK:

Sub Click(Source As Button)

Set WshShell = CreateObject("WScript.Shell")

If (WshShell Is Nothing) Then 

	Msgbox "Failed to create shell object."

	Exit Sub ' EXIT

End If



WshShell.SendKeys "%F", True

WshShell.SendKeys "g"



WshShell.SendKeys "."	

WshShell.SendKeys "2"

WshShell.SendKeys "5"

WshShell.SendKeys "{TAB}" 



WshShell.SendKeys "."	

WshShell.SendKeys "2"

WshShell.SendKeys "5"

WshShell.SendKeys "{TAB}" 



WshShell.SendKeys "."	

WshShell.SendKeys "2"

WshShell.SendKeys "5"

WshShell.SendKeys "{TAB}" 



WshShell.SendKeys "."	

WshShell.SendKeys "2"

WshShell.SendKeys "5"



WshShell.SendKeys "{ENTER}" ' 

End Sub