IBM Lotus Symphony
|
Følgende eksempler gjelder en ny dialogboks kalt "Dialog1". Bruk verktøyene på Verktøykasse-linjen i dialogredigering for å opprette dialogboksen og legge til følgende kontroller: en avmerkingsboks kalt "CheckBox1", et etikettfelt kalt "Label1", en knapp kalt "CommandButton1" og en listeboks kalt "ListBox1".
![]() |
Vær konsekvent i bruken av store og små bokstaver når du knytter en kontroll til en objektvariabel. |
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
rem globale definisjoner av variabler
Dim oDialog1 AS Object
Sub StartDialog1
BasicLibraries.LoadLibrary("Tools")
oDialog1 = LoadDialog("Standard", "Dialog1")
oDialog1.Execute()
end sub
Sub Sample1
BasicLibraries.LoadLibrary("Tools")
oDialog1 = LoadDialog("Standard", "Dialog1")
REM hent dialogboksmodell
oDialog1Model = oDialog1.Model
REM vis tekst som Label1
oLabel1 = oDialog1.GetControl("Label1")
MsgBox oLabel1.Text
REM angi ny tekst for kontrollen Label1
oLabel1.Text = "New Files"
REM vis modellegenskaper for kontrollen CheckBox1
oCheckBox1Model = oDialog1Model.CheckBox1
MsgBox oCheckBox1Model.Dbg_Properties
REM angi ny tilstand for CheckBox1 for kontrollmodell
oCheckBox1Model.State = 1
REM vis modellegenskaper for kontrollen CommandButton1
oCMD1Model = oDialog1Model.CommandButton1
MsgBox oCMD1Model.Dbg_Properties
REM vis egenskaper for kontrollen CommandButton1
oCMD1 = oDialog1.GetControl("CommandButton1")
MsgBox oCMD1.Dbg_Properties
REM utfør dialogboksen
oDialog1.Execute()
End Sub
Sub AddEntry
BasicLibraries.LoadLibrary("Tools")
oDialog1 = LoadDialog("Standard", "Dialog1")
REM legger til en ny oppføring i listeboksen
oDialog1Model = oDialog1.Model
oListBox = oDialog1.GetControl("ListBox1")
dim iCount as integer
iCount = oListbox.ItemCount
oListbox.additem("New Item" & iCount,0)
end sub
Sub RemoveEntry
BasicLibraries.LoadLibrary("Tools")
oDialog1 = LoadDialog("Standard", "Dialog1")
REM fjern den første oppføringen fra listeboksen
oDialog1Model = oDialog1.Model
oListBox = oDialog1.GetControl("ListBox1")
oListbox.removeitems(0,1)
end sub