Opening a Dialog With Basic

Trong cửa sổ LibreOffice BASIC cho hộp thoại bạn đã tạo, rời bộ sửa hộp thoại bằng cách nhấn vào thẻ tên của Mô-đun cho đó hộp thoại được gán. Thẻ tên ở dưới cửa sổ.

Hãy gõ mã theo đây cho hàm phụ tên Dialog1Show. Trong mẫu này, bạn tạo một hộp thoại tên "Dialog1":


Sub Dialog1Show
    With GlobalScope.BasicLibraries
       If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
    End With
    oDialog1 = Tools.ModuleControls.LoadDialog("Standard", "Dialog1")
    oDialog1.Execute()
End Sub

Không dùng "LoadDialog", bạn vẫn còn có thể gọi mã như theo :


Sub Dialog1Show
    DialogLibraries.LoadLibrary("Standard")
    oDialog1 = CreateUnoDialog( DialogLibraries.Standard.Dialog1 )
    oDialog1.Execute()
End Sub

Khi bạn thực hiện mã này, hộp thoại "Dialog1" sẽ mở. Để đóng nó, nhấn vào nút đóng (x) trên thanh tựa.

Please support us!