Programming Examples for Controls in the Dialog Editor

འོག་ལུ་ཡོད་མི་དཔེ་འདི་ཚུ་ The following examples are for a new ཌའི་ལོག་གསརཔ་ called "Dialog1". Use the tools on the Toolbox bar in the dialog editor to create the dialog and add the following controls: a Check Box called "CheckBox1", a Label Field called "Label1", a Button called "CommandButton1", and a List Box called "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.

ཌའི་ལོག་བཀྲམ་སྟོན་འབད་དོ།


རིམ་ འགྱུར་ཅན་ཚུའི་ངེས་ཚིག་སྤི་ཁྱབ།
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")
    རིམ་ ཌའི་ལོག་དཔེ་ལེན།
    oDialog1Model = oDialog1.Model
    རིམ་ ༡ ཁ་ཡིག་གི་ཚིག་ཡིག་བཀྲམ་བཏོན་འབད།
    oLabel1 = oDialog1.GetControl("Label1")
    MsgBox oLabel1.Text
    རིམ་ ཚད་འཛིན་ཁ་ཡིག་ ༡ གི་དོན་ལུ་ཚིག་ཡིག་གསརཔ་གཞི་སྒྲིག་འབད།
    ཨོ་ཁ་ཡིག་ ༡ ཚིག་ཡིག་= "New Files"
    རིམ་ ཚད་འཛིན་ཞིབ་དཔྱད་སྒྲོམ་ ༡ གི་དོན་ལུ་རྒྱུ་དངོས་ཚུའི་དཔེ་བཀྲམ་བཏོན་འབད།
    oCheckBox1Model = oDialog1Model.CheckBox1
    MsgBox oCheckBox1Model.Dbg_Properties
    ཚད་འཛིན་གྱི་དཔེ་དོན་ལུ་ཞིབ་དཔྱད་སྒྲོམ་ ༡ དོན་ལུ་གནས་ལུགས་གསརཔ་གཞི་སྒྲིག་འབད།
    oCheckBox1Model.State = 1
    རིམ ཚད་འཛིན་བརྡ་བཀོད་ཨེབ་རྟ་ ༡ གི་དོན་ལུ་རྒྱུ་དངོས་ཚུའི་དཔེ་བཀྲམ་བཏོན་འབད།
    oCMD1Model = oDialog1Model.CommandButton1
    MsgBox oCMD1Model.Dbg_Properties
    རིམ ཚད་འཛིན་བརྡ་བཀོད་ཨེབ་རྟ་ ༡ གི་རྒྱུ་དངོས་ཚུ་བཀྲམ་བཏོན་འབད།
    oCMD1 = oDialog1.GetControl("CommandButton1")
    MsgBox oCMD1.Dbg_Properties
    རིམ ཌའི་ལོག་ལག་ལེན་འཐབ།
    oDialog1.Execute()
End Sub

ཐོ་ཡིག་སྒྲོམ་ནང་ལུ་ཐོ་བཀོད་ཁ་སྐོང་འབད།


Sub AddEntry
    With GlobalScope.Basiclibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = ModuleControls.LoadDialog("Standard", "Dialog1")
    རིམ་ཐོ་ཡིག་སྒྲོམ་ནང་ལུ་ཐོ་ཡིག་གསརཔ་ཁ་སྐོང་འབདཝ་ཨིན།
    oDialog1Model = oDialog1.Model
    oListBox = oDialog1.GetControl("ListBox1")
    Dim iCount as integer
    iCount = oListbox.ItemCount
    ཨོ་ཐོ་ཡིག་སྒྲོམ།རྣམ་གྲངས་ཁ་སྐོང་།("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")
    རིམ་ ཐོ་ཡིག་སྒྲོམ་འདི་ནང་ལས་ཐོ་བཀོད་དང་པམ་འདི་རྩ་བསྐྲད་གཏང་།
    oDialog1Model = oDialog1.Model
    oListBox = oDialog1.GetControl("ListBox1")
    oListbox.removeitems(0,1)
End Sub

Please support us!