Programming Examples for Controls in the Dialog Editor
གཤམ་གསལ་དཔེ་གཞི་ནི་མིང་ལ་ "Dialog1" ཡི་གླེང་སྒྲོམ་གསར་པ་ལ་དམིགས་པ་ཡིན། གླེང་སྒྲོམ་རྩོམ་སྒྲིག་ཆས་ནང་གི་ཡོ་བྱད་ཚང་ཚང་སྟེང་གི་ཡོ་བྱད་བདེ་སྤྱད་ན་གླེང་སྒྲོམ་གསར་འཛུགས་བྱ་ཐུབ་པ་མ་ཟད་གཤམ་གསལ་ཚོད་འཛིན་ཆས་གསབ་སྣོན་བྱ་བ་སྟེ་
ཚོད་འཛིན་ཆས་དེ་བྱ་ཡུལ་འགྱུར་ཆད་ལ་ཟུར་སྣོན་བྱ་སྐབས་ བྲི་བའི་ཡི་གེའི་ཆེ་ཆུང་གཅིག་མཐུན་རྒྱུན་འཁོངའཁོང་བྱེད་པ།
ཁུར་སྣོན་གླེང་སྒྲོན་གྱི་ཁྱོན་ཡོངས་རྟེན་གྲངས་
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 LibreOffice Macros and Dialogs.
གླེང་སྒྲོམ་མངོན་པ་
rem ཁྱོན་ཡོངས་འགྱུར་ཚད་ཀྱི་མཚན་འཇོག་
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 གླེང་སྒྲོམ་འདྲ་དབྱིབས་ཐོབ་པ་
oDialog1Model = oDialog1.Model
REM Label1 གི་ཡི་གེ་མངོན་པ་
oLabel1 = oDialog1.GetControl("Label1")
MsgBox oLabel1.Text
REM བཀོད་སྒྲིག་ཚོད་འཛིན་ཆས་ Label1 ཡི་གི་་གསར་པ་
oLabel1.Text = "New Files"
REM ཚོད་འཛིན་ཆས་ CheckBox1 ཡི་འདྲ་དབྱིབས་གཏོགས་གཤིས་མངོན་པ་
oCheckBox1Model = oDialog1Model.CheckBox1
MsgBox oCheckBox1Model.Dbg_Properties
REM གིས་ CheckBox1 ཚོད་འཛིན་ཆས་ཀྱི་འདྲ་དབྱིབས་ཀྱིས་གནས་སྟངས་གསར་པ་བཀོད་སྒྲིག་བྱེད་
oCheckBox1Model.State = 1
REM ཚད་འཛིན་ཆས་ CommandButton1 ཡི་འདྲ་དབྱིབས་གཏོགས་གཤིས་མངོན་པ་
oCMD1Model = oDialog1Model.CommandButton1
MsgBox oCMD1Model.Dbg_Properties
REM མངོན་པའི་ཚོད་འཛིན་ CommandButton1 ཡི་གཏོགས་གཤིས་
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
ListBox ནང་གི་གཤར་བྱང་སུབ་པ་
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