LS simulation of F) keypress

Hi there, I would like to know, how to simulate an users F9 keypress in a document in Lotus Script programmatically. So which command or command sequence is equivalent to F9 ?

TIA, Joe

I guess you are looking for notesUIDocument.Refresh()

Perhaps you can try to use refresh method.

https://help.hcltechsw.com/dom_designer/9.0.1/appdev/H_REFRESH_METHOD_UIDOC.html

Regards,

Amit Sharma

Thanks for your replies, but unfortunately refesh does not do the job like F9.

I want that certain action buttons appear in edit mode and though the conditions are ok (tested it in a computed field) and the following LS-code gets executed, the user has to press F9 to let the buttons appear.

Sub Postmodechange(Source As Notesuidocument)
doc.WFenabledButtons=Anforderung.EnabledButtons 'Activate the right workflow buttons
Source.reload
Source.Refresh
Source.RefreshHideFormulas
Source.Refresh
Source.RefreshHideFormulas
End Sub

Running on Win 10 with Notes/Designer Version 11

Any ideas ?

TIA, Joe

Seems existing code is not able to recalculate all the default value, translation, and validation formulas.

Can you try using "ComputewithForm" method.

https://help.hcltechsw.com/dom_designer/10.0.1/basic/H_COMPUTEWITHFORM_METHOD.html

Regards,

Amit Sharma

Hello Amit,

thanks a lot for your Reply.

Tried now several combinations of the below code after you suggested computewithform :

doc.WFenabledButtons=Anforderung.EnabledButtons 'Activate the workflow buttons
Source.reload
Call doc.ComputeWithForm(False, False)
Source.Refresh
Source.RefreshHideFormulas

Also ComputeWithform alone … Nada, zero, nix ! I have to press F9 to get the Buttons. What is also very strange, is the fact that I made those buttons that should appear in edit mode, now also appear for testing in read mode and they are in read mode available, but dissapear in edit mode and only reappear again after pressing the F9 button.

Is there a formula language command that is as powerful as F9. Evaluate "@F9" or similar could do the job !?

TIA, Joe

What is the behavior if you do not open document manually.

I mean you must be trying to open document from some view. Try to open document using "Ctrl" + "E" and check what happens.

Can you try to play with Querymodechange event using the method suggested earlier and then just refresh in Postmodechange event.

Example -->

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)

<Implement code >

End Sub

Sub Postmodechange(Source As Notesuidocument)
Call Source.Refresh
End Sub

Regards,

Amit Sharma

Hello Amit,

thanks for the sugesstion I got from you via email. But unfortunately it does not work.

Firstly is the form in QueryModeChange event not in edit mode, thus I can't change fields for the UI.

Secondly seems the problem to be that the following test only works if one presses F9:

x:= @IsMember( "ZG"; WFEnabledButtons);
!IsStaff | !X

If I remove the !IsStaff then it works even without F9, but everybody not in he HR deparment has also access.

I transformed it with DeMorgans rule to :

!( IsStaff & X)

I had the hope that only the or (|) is F9 addicted, but it didn't work, too .

I think I should open a ticket.

Joe

Hi Jochen,

As per the case journey so far, it appears to me that application(or Specific FORM) might needs redesigning to achieve the requirements.

You can definitely open a ticket with requirement.

However,I would also suggest to go through below URL.

https://support.hcl-software.com/csm?id=kb_article&sysparm_article=KB0010420

This information will help you in defining your detailed requirement alongwith minimal code that can be used to reproduce the issue at Support team's end.

Support team then can guide you how to proceed on same.

Regards,

Amit Sharma

Hi Amit,

problem solved. I have used an already existing field of type text and changed its formula to a boolean result and used this field in another formula expecting there also a boolean value. I simply havn't seen it. A member of the german "Das Notes Forum" suggest to verify the type ... he was absolutely right and I owe him at least a beer. Now it works.

One final question : How comes that it did not cause an error and that F9 is not effected by @formula type borders ?

TIA, Joe

Glad that issue is resolved.

Joe, it looks to be an issue of its own kind where F9 is bypassing the error and not respecting the datatype of field or return value of the field.

As per my research, I havenot seen such issue in past.

I hope there will be similar scenarios with respect to F9 and Support team definitely would like to test the scenario and come up with there investigation/solution on same.

Since the issue has been resolved, you can now continue to work with the application.

And yes, you definitely owe a beer to the colleague. Cheers :).

Regards,

Amit Sharma

Amit,

if you guys need a small DB where this problem is reproducable ... np, I had already one prepared. Only have to describe how to do it. If interested, just send an email.

Joe

Thanks Joe.

Please attach the database and reproducible procedure alongwith the wokraround performed.

I will reproduce this at my verification environment and then will create a problem report for our support team to investigate.

Note --> Do mention the notes client,server and OS version. Need to ensure this is not version specific.
Need to share all the detailed information for extended team to investigate.

Regards,

Amit Sharma

Hi Jochen Herrmann !

Maybe this code will help (in agent or library function or click button):

Option Public
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (Byval hwnd As Long, Byval msg As Long, Byval wParam As Long, Byval vParam As Long) As Long
Declare Function GetFocus Lib "user32" () As Long
Sub Initialize
On Error Resume Next
Dim hwnd As Long
hwnd = GetFocus ()


Call PostMessage (hWnd, 256, &h78, &h430001)
Call PostMessage (hWnd, 257, &h78, &hC0430001)
End Sub