Marginal Insanity

Just remedied a recurring eyesore with a Lotus Notes database I’m working on. The culprit: displaying the form left-aligned when it is first displayed. More to the point, contents of the form are aligned 1″ from the left by default. What if the contents are aligned less than 0.75″ from the left, (the left edge of the screen’s orientation when the form is displayed is originally at 0.75″?) This problem is usually encountered when forms are designed to be printer-friendly, just as in my case.

The amount of similar posts in Notes.Net and the amount of time it took me to get something working for me just shows how much something seemingly simple can get so seemingly hopeless and absolutely frustrating in Notes development.

Nevertheless I found the workaround for me. Thanks to Larry E. Gearing for taking the time to post something comprehensive for all other developers lost at Notes.Net, I got around the hassle and was able to proceed elsewhere. His proposed workaround is to make use of keybd_event native to MS.

Here’s the content of Larry’s response:

(Revised 2004/03/09, still learning)
There are many ways to open a document. Most of the suggestions under this topic worked in some but not all cases. Most failed when a document in a view is right mouse clicked and “edit” is selected from the drop down.

My biggest obstacle was the I had a field with the “Give field initial (default) focus” option checked. When I opened my form in edit mode, Ctrl+Home would not move focus off that field. I guess this is a reason to avoid the initial focus option!

What I am using now is
(1) first line of form is a blank line with text property set to left margin 0″ absolute and “hide when printed”. This will force the form to the left when opened in read mode and not cause a problem when the form is printed.
(2) to force the form to the left when opened in edit mode I added
– to Global declarations: Declare Sub keybd_event Lib “user32.dll” (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer, Byval dwExtraInfo As Integer)
– to Post Open
Sub Postopen (Source As Notesuidocument)
‘force to left
Source.HorzScrollBar=True ‘leave it on
‘keybd_event declared in Globals
keybd_event &H11,0,0,0 ‘ Ctrl on
keybd_event &H24,0,0,0 ‘ Home
keybd_event &H24,0,2,0 ‘ Home off
keybd_event &H11,0,2,0 ‘ Ctrl off
End Sub

This seems to be working, 2004/03/09

Same here man! Way to go!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: