LibreOffice 25.2 Help
নিম্নোক্ত উদাহরণসমূহ "Dialog1" নামের একটি নতুন ডায়ালগ এর জন্য। ডায়ালগ তৈরি করতে এবং নিম্নোক্ত কন্ট্রোল: "CheckBox1" নামের একটি পরীক্ষণবাক্স, "Label1" নামের একটি মোড়ক ক্ষেত্র, "CommandButton1" নামের একটি বোতাম এবং "ListBox1" নামের একটি তালিকা বাক্স যোগ করতে ডায়ালগ সম্পাদকের টুলবক্স বারের টুল ব্যবহার করুন ।
একটি বস্তু চলকে কন্ট্রোল সংযোজন করার সময় বড় হাতের এবং ছোট হাতের অক্ষর সম্পর্কে সতর্ক থাকতে হবে।
Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)
Dim oLib as Object ' com.sun.star.script.XLibraryContainer
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
LoadDialog function is stored in Tools.ModuleControls available from Application Macros and Dialogs.
rem global definition of variables
Dim oDialog1 AS Object
Sub StartDialog1
    With GlobalScope.BasicLibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = Tools.ModuleControls.LoadDialog("Standard", "Dialog1")
    oDialog1.Execute()
End Sub
Sub Sample1
    With GlobalScope.Basiclibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = Tools.LoadDialog("Standard", "Dialog1")
    REM get dialog model
    oDialog1Model = oDialog1.Model
    REM display text of Label1
    oLabel1 = oDialog1.GetControl("Label1")
    MsgBox oLabel1.Text
    REM set new text for control Label1
    oLabel1.Text = "New Files"
    REM, কন্ট্রোল CheckBox1 এর জন্য মডেলের বৈশিষ্ট্যাবলী প্রদর্শন করে
    oCheckBox1Model = oDialog1Model.CheckBox1
    MsgBox oCheckBox1Model.Dbg_Properties
    REM দ্বারা কন্ট্রোল মডেলের CheckBox1 এর জন্য নতুন অবস্থা নির্ধারিত হয়
    oCheckBox1Model.State = 1
    REM display model properties for control CommandButton1
    oCMD1Model = oDialog1Model.CommandButton1
    MsgBox oCMD1Model.Dbg_Properties
    REM, কন্ট্রোল CommonButton1 এর জন্য বৈশিষ্ট্যাবলী প্রদর্শন করে
    oCMD1 = oDialog1.GetControl("CommandButton1")
    MsgBox oCMD1.Dbg_Properties
    REM ডায়ালগ কার্যকর করে
    oDialog1.Execute()
End Sub
Sub AddEntry
    With GlobalScope.Basiclibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = ModuleControls.LoadDialog("Standard", "Dialog1")
    REM, ListBox এ একটি নতুন ভুক্তি যোগ করে
    oDialog1Model = oDialog1.Model
    oListBox = oDialog1.GetControl("ListBox1")
    Dim iCount as integer
    iCount = oListbox.ItemCount
    oListbox.additem("New Item" & iCount,0)
End Sub
Sub RemoveEntry
    With GlobalScope.Basiclibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = Tools.ModuleControls.LoadDialogLoadDialog("Standard", "Dialog1")
    REM, ListBox থেকে প্রথম ভুক্তিটি অপসারণ করে
    oDialog1Model = oDialog1.Model
    oListBox = oDialog1.GetControl("ListBox1")
    oListbox.removeitems(0,1)
End Sub