IBM Lotus Symphony


Programmbeispiele für Kontrollfelder im Dialogeditor

Die folgenden Beispiele beziehen sich auf einen neuen Dialog mit der Bezeichnung "Dialog1". Verwenden Sie die Tools in der Leiste Toolbox des Dialogeditors zum Erstellen des Dialogs und zum Hinzufügen der folgenden Kontrollfelder: Ein Kontrollkästchen mit dem Namen "CheckBox1", ein Beschriftungsfeld mit dem Namen "Label1", eine Schaltfläche mit dem Namen "CommandButton1" und ein Listenfeld mit dem Namen "ListBox1".

Symbol für Warnung Beim Zuweisen des Kontrollfelds an eine Objektvariable ist die Schreibweise wichtig. Wenn der Name des Kontrollfelds klein geschrieben wurde, muss dieser auch mit derselben Schreibweise abgefragt werden.

Globale Funktion zum Laden von Dialogen

Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)

Dim oLib as Object

Dim oLibDialog as Object

Dim oRuntimeDialog as Object

If IsMissing(oLibContainer ) then

oLibContainer = DialogLibraries

End If

oLibContainer.LoadLibrary(LibName)

oLib = oLibContainer.GetByName(Libname)

oLibDialog = oLib.GetByName(DialogName)

oRuntimeDialog = CreateUnoDialog(oLibDialog)

LoadDialog() = oRuntimeDialog

End Function

Dialog anzeigen

rem Globale Variablendefinition

Dim oDialog1 AS Object

Sub StartDialog1

BasicLibraries.LoadLibrary("Tools")

oDialog1 = LoadDialog("Standard", "Dialog1")

oDialog1.Execute()

end sub

Eigenschaften von Kontrollfeldern im Programm lesen oder bearbeiten

Sub Sample1

BasicLibraries.LoadLibrary("Tools")

oDialog1 = LoadDialog("Standard", "Dialog1")

REM Modell des Dialogs abrufen

oDialog1Model = oDialog1.Model

REM Beschriftung des Kontrollfelds Label1 anzeigen

oLabel1 = oDialog1.GetControl("Label1")

MsgBox oLabel1.Text

REM Neuen Text am Kontrollfeld Label1 setzen

oLabel1.Text = "New Files"

REM Anzeigen der Modelleigenschaften für das Kontrollfeld CheckBox1

oCheckBox1Model = oDialog1Model.CheckBox1

MsgBox oCheckBox1Model.Dbg_Properties

REM Neuen Status für CheckBox1 am Modell des Kontrollfelds setzen

oCheckBox1Model.State = 1

REM Anzeigen der Modelleigenschaften für das Kontrollfeld CommandButton1

oCMD1Model = oDialog1Model.CommandButton1

MsgBox oCMD1Model.Dbg_Properties

REM Anzeigen der Eigenschaften des Kontrollfelds CommandButton1

oCMD1 = oDialog1.GetControl("CommandButton1")

MsgBox oCMD1.Dbg_Properties

REM Dialog ausführen

oDialog1.Execute()

End Sub

Eintrag in einer ListBox hinzufügen

Sub AddEntry

BasicLibraries.LoadLibrary("Tools")

oDialog1 = LoadDialog("Standard", "Dialog1")

REM Setzt einen neuen Eintrag in die ListBox

oDialog1Model = oDialog1.Model

oListBox = oDialog1.GetControl("ListBox1")

dim iCount as integer

iCount = oListbox.ItemCount

oListbox.additem("New Item" & iCount,0)

end sub

Eintrag aus einer ListBox entfernen

Sub RemoveEntry

BasicLibraries.LoadLibrary("Tools")

oDialog1 = LoadDialog("Standard", "Dialog1")

REM Löscht den ersten Eintrag aus der ListBox

oDialog1Model = oDialog1.Model

oListBox = oDialog1.GetControl("ListBox1")

oListbox.removeitems(0,1)

end sub


Produktfeedback | Zusätzliche Dokumentation | Marken