Domino 9 und frühere Versionen > ND6: Entwicklung

Teilmasken einblenden / ausblenden

<< < (2/2)

MartinMG:
hallo,

bin zwar selbst kein profi aber vielleicht kann ich helfen.
es sollte funktionieren wenn du das dokument speicherst und sofort wieder aufrufst.
folgendes hab ich (glaub sogar hier im forum) gefunden:

Hi, kann dir nur sagen das RitchText Felder in Notes erst beim Speichern angelegt werden und somit dann erst den Inhalt anzeigen.

Du musst einfach uidoc Speichern -> schliessen -> wieder öffen in das Script einbauen.

Code:
.....
Set obj_CurrentDocument = uidoc.Document
.....
Call obj_CurrentDocument.Save(True, True)
Call uidoc.close
Set uidoc = workspace.EditDocument(True,obj_CurrentDocument)

dann gibts es auf der webside von anton tauscher noch ein script was genau das macht.
http://www.anton-tauscher.de
script als rtf-dokument lade ich mit hoch. hab es aber nie ausprobiert.

gruß martin

Raymond:
Das Ganze lässt sich auch realisieren, ohne das Dokument speichern zu müssen.

Grundidee:
1. backendoc wird erstellt
2. das zughörige uidoc wird geöffnet
3. der Wert des Feldes, welches die berechnete Teilmaske definiert wird vom User (bspw. via Dialog) geändert
4. das uidoc wird wieder geschlossen (passiert aber erst, wenn der Code fertig ausgeführt wurde)
5. ein neues uidoc wird basierend auf dem backendoc (noch im memory) geöffnet
6. die referenz von backendoc zum alten uidoc wird gelöscht
7. dem backendoc wird das document property des neuen uidoc zugewiesen...

Tönt relativ abgefahren, funktioniert aber ganz gut.

Hier der ScriptCode...


Sub insertSubform(strSubformposition As String)
   'modify a rich text field or the selection for a computed subform WITHOUT having to save and re-open the document
   'The basic idea:
   '1. creation of a backend-document
   '2. open the correspondig uidoc
   '3. close uidoc (will not happen until the code is finished executing
   '4. open a new uidoc based on the backend-document that is still in memory
   '5. delete the reference of the backend-document to the old uidoc
   '6. assign the document property of the new uidoc to the backen-document
   
   '-> with this procedure it is possible to load subforms without having to save > close > reopen the document
   'arguments: strSubformposition: Top | Bottom
   
   Const FORM = "Vorlage"
   
   Dim session As NotesSession
   Dim ws As NotesUIWorkspace
   Dim db As NotesDatabase
   Dim uidocOld As NotesUIDocument 'the original instance of the uidoc
   Dim uidocNew As NotesUIDocument 'the new instance of the uidoc
   Dim docThis As NotesDocument
   Dim strSubform As String
   
   Set session = New NotesSession
   Set ws = New NotesUIWorkspace
   Set db = session.CurrentDatabase
   Set uidocOld = ws.CurrentDocument
   Set docThis = uidocOld.document
   docThis.Form = FORM
   
   'find all available subforms in this db
   Const TITLE = "title"
   Const PROMPT = "prompt"
   
   Dim strSubFormsArray() As String
   Dim varSubForms As Variant
   Dim intJ As Integer
   
   varSubForms = dbDesign.subformDocuments
   Redim strSubFormsArray(Ubound(varSubForms)) As String
   
   Forall varK In varSubForms
      strSubFormsArray(intJ) =  varSubForms(intJ).~$TITLE(0)   
      intJ = intJ + 1
   End Forall
   
   
   strSubform = ws.Prompt( PROMPT_OKCANCELCOMBO, TITLE, PROMPT,  strSubFormsArray(0), strSubFormsArray )   
   If strSubformPosition =  "Top" Then
      'make sure the subform can not be used twice
      If docThis.SubformBottom(0) <> strSubform Then
         docThis.SubormTop = strSubform
      Else
         Exit Sub
      End If
      docThis.SubformTop = strSubform
   Elseif strSubformPosition = "Bottom" Then
      'make sure the subform can not be used twice
      If docThis.SubformTop(0) <> strSubform Then
         docThis.SubformBottom = strSubform
      Else
         Exit Sub
      End If
   End If
   
   'prevent user form beeing asked to save document
   docThis.SaveOptions = "0"
   
   'close uidoc. it won't actually happen until the code is finished executing
   Call uidocOld.Close(True)
   
   'create a new uidoc and open the backend doc that is still in memory
   Set uidocNew = ws.EditDocument(True, docThis)
   
   'delete the reference to uidocOld
   'this is necessary because the code below affects it if left in memory
   
   Set docThis = uidocNew.Document
   
   'remove the saveoptions field
   docThis.RemoveItem("SaveOptions")
   
End Sub

Gruss

Ray

schlissm:
hallo,
wollte mich noch mal bei euch für die vielen echt hilfreichen lösungsvorschläge bedanken ...

leider konnte ich in letzter zeit aus der firma nichts in dieses forum posten ... kam immer ein zeitüberlauf ... deswegen hatte ich das hier schon fast vergessen...


hab es jetzt einfach über die ausblenden funktionen des textes gemacht ...

cu


schlissm

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln