Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: TomLudwig am 20.12.06 - 09:14:30

Titel: Probleme mit EditMode
Beitrag von: TomLudwig am 20.12.06 - 09:14:30
Guten Morgen zusammen,

ich habe ein Problem, an dem ich mittlerweile seit zwei Tagen verzweifle...

In einer Maske soll der Inhalt eines RichTextFeldes per Button ausgetauscht werden. Hierzu wird das neue RichTextFeld aus einem anderen Dokument in das gerade geöffnete kopiert.

Code
                Call uidoc.FieldClear("StaffPicture")
		Call uidoc.Save()		
		Set doc = uidoc.Document			
		uidoc.EditMode = False	
		Set item = QDoc.GetFirstItem("StaffPicture")
		If Not item Is Nothing Then
			Call doc.CopyItem(item, "StaffPicture")
			Call doc.Save(True, False)
		End If
		uidoc.EditMode = True	

Funktioniert auch bis hier hin wunderbar! ABER: Wenn nun in der nächsten Quellcodezeile mit dem "uidoc" irgendetwas passiert, dann ist das Item "StaffPicture" wieder leer.
Ich möchte z.B. via uidoc.fieldsettext einem weiteren Feld einen Wert zuweisen. -> StaffPicture ist leer
Oder das "uidoc" einfach via uidoc.save() speichern. -> StaffPicture ist leer.

Kann mir da jemand helfen?
Titel: Re: Probleme mit EditMode
Beitrag von: Glombi am 20.12.06 - 09:30:55
Versuch mal folgendes:

dim rtitem as NotesRichTextItem

Call uidoc.FieldClear("StaffPicture")
Call uidoc.Save()
Set doc = uidoc.Document
uidoc.EditMode = False
Set item = QDoc.GetFirstItem("StaffPicture")
If Not item Is Nothing Then
set rtitem = doc.CopyItem(item, "StaffPicture")
call rtitem.Update
Call doc.Save(True, False)
End If
uidoc.EditMode = True


und wenn das nicht geht, dann so

dim ws as New NotesUIWorkspace
Call uidoc.FieldClear("StaffPicture")
Call uidoc.Save()
Set doc = uidoc.Document
uidoc.EditMode = False
call uidoc.Close
Set item = QDoc.GetFirstItem("StaffPicture")
If Not item Is Nothing Then
Call doc.CopyItem(item, "StaffPicture")
Call doc.Save(True, False)
End If
call ws.EditDocument( True, doc )


Andreas
Titel: Re: Probleme mit EditMode
Beitrag von: TomLudwig am 20.12.06 - 09:56:58
Ich wollte das Schließen des Dokuments so gern umgehen.... :-(

Aber es scheint wirklich nicht anders zu gehen.
Danke Glombi für deine schnelle Hilfe.

--> Version 2 funktioniert!


P.S.: Wenn irgend jemand weiß warum das nur so geht, ich würd mich für das WIE und WARUM auch intressieren ;-)
Titel: Re: Probleme mit EditMode
Beitrag von: Glombi am 20.12.06 - 10:10:27
Wieso, weshalb, warum - wer nicht fragt bleibt dumm  ;)

Also, Auszug aus der Designer Hilfe zu "NotesUIDocumnet.reload":

Call notesUIDocument.Reload( )
Usage
This method is valid only when the document is in Edit mode.
Modifications made to non-rich-text items on the back-end document accessed through the Document property appear on the current document immediately. Modifications made to non-rich-text items on the corresponding back-end document accessed from the front-end document but not through the Document property (for example, if you use GetDocumentByUNID) do not appear immediately unless the AutoReload property is True. To cause the modifications to appear when the AutoReload property is False, call Reload or close the document and reopen it.

Modifications made to rich-text items on the back-end document do not appear on the current document until it is closed and reopened.

Modifications made to items on the corresponding back-end document accessed outside the front-end document (for example, by an agent or another user) do not appear unless the document is closed and reopened.


Andreas