Loading script libraryin view - error when in the global options

Hi,

I want to load (use) my script lib in a view, and I am a bit confused where to place the <Use “mylib”>

When I place it in the (Globals) options, I get an “error loading use or uselsx” error message.

When I place it in the (View) options, it’s OK.

Just for my understanding: What is the difference, and why do I get this error in the (Globals) section?

thanks in advance

Uwe

Subject: loading script libraryin view - error when in the global options

A script library imported from the options section is only available in LS events you see in the objects pane, while a library loaded from the global options section is also available in view actions.

Off hands, I think that you should not get that error, if there are no other libraries loaded that might cause circular dependencies. But I’m just talking from the top of my head.

Have you tried to close all design elements and to recompile all LotusScript?

Subject: RE: loading script libraryin view - error when in the global options

yes - i did recompile (and closed/reopened Notes and deleted cache.ndk - for some other reason).

It does not error with every library:

<Use “helv_UIView”> doesn’t work

but <Use “helv_UIDoc”> is OK

helv_UIView has only one function:

===================================

Function helvUIViewcheckPaste(view As NotesView) As Boolean

’ wird im QueryPaste-Event eines Views aufgerufen

’ prüft, ob Einfügen aus Zwischenablage erlaubt ist

@author: Uwe Jandt

@modified: 04.02.2008

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim flag As String

Dim viewnames As Variant

Dim viewIdent As String



helvUIViewcheckPaste = True

’ Feldnamen im Profildoc

Const CProfileForm = "ProfileDatabaseSettings"

Const CFNameRadio = "viewpaste"

Const CFNameDialist = "viewpasteSelection"

’ Wenn Viewaliases vorhanden, dann den ersten nehmen, sonst den Viewnamen

If Isempty(view.Aliases) Then

	viewIdent = view.Name

Else

	viewIdent = view.Aliases(0)

End If

’ Info im DBProfile, ob copy/paste in Views erlaubt ist

Set db = session.CurrentDatabase

Set doc = db.GetProfileDocument(CProfileForm)

If doc.HasItem(CFNameRadio) Then

	flag = doc.GetItemValue(CFNameRadio)(0)

	Select Case flag

	Case "0":

		Msgbox "Einfügen von Dokumenten aus der Zwischenablage in dieser DB nicht erlaubt.",48,"Achtung"

		helvUIViewcheckPaste = False

	Case "2":

		If doc.HasItem(CFNameDialist) Then

			viewnames = doc.GetItemValue(CFNameDialist)

’ Viewname oder Alias mit der Profiledoc-Liste vergleichen

			Forall v In viewnames

				If v = viewIdent Then

					helvUIViewcheckPaste = False

					Msgbox "Einfügen von Dokumenten aus der Zwischenablage in dieser Ansicht nicht erlaubt.",48,"Achtung"

					Exit Function

				End If

			End Forall

		End If

	End Select

	

End If

End Function

======================================

Maybe you see sth obvious in the code?

Do the compiler checks the functions, and stops because I pass the parameter “view As NotesView” in the function?

But as I said: when I place it in the views options, it is OK

Uwe

Subject: RE: loading script libraryin view - error when in the global options

I could create a new script library called helv_UIView, paste your code, add a

Use “helv_UIView”

statement to the global options of a view and add the line

Call helvUIViewcheckPaste(Source.View)

to the view’s QueryPaste event without any problem, so there’s no obvious problem with the code per-se. This is on 7.0.3, though.

If a recompile doesn’t solve the issue, I would still suspect that there are other code modules loading more libraries which in turn might try to load helv_UIView again.

As a note by:

Do you know LDDoc (lsdoc.org)? I notice the use of JavaDoc style @-parameters, but not in an LotusScript.doc formatted comment.

Subject: RE: loading script libraryin view - error when in the global options

Hi Harkpabst Meliantrop,

sorry for the very late response … maybe you will read it :wink:

I solved it with an agent, called by an action.

and no, I didn’t know LDDoc, thx for the link

Uwe

Subject: RE: loading script libraryin view - error when in the global options

Hmmmm …

… just got the very same error. After placing the use statement ind the view action’s options, saving the view and removing the use statement from the action again, the error was gone.

Strange.