የ ፕሮግራም ምሳሌዎች ለ መቆጣጠሪያ በ ንግግር ማረሚያ ውስጥ

ይዞታዎች

# Programming Examples for Controls in the Dialog Editor

የ ሚቀጥሉት ምሳሌዎች ለ አዲስ ንግግር ለተባለ "ንግግር1" ነው: ይጠቀሙ መሳሪያዎችን ከ እቃ ሳጥን መደርደሪያ ውስጥ በ ንግግር አራሚ ንግግር ለ መፍጠር: እና ለ መጨመር የሚከተሉትን መቆጣጠሪያዎች: ከ ምልክት ማድረጊያ ሳጥን የተባለ "ምልክት ማድረጊያ ሳጥን1": ከ የ ምልክት ሜዳ የተባለ "ምልክት1": ከ ቁልፍ የተባለ "የ ትእዛዝ ቁልፍ1": እና ከ ዝርዝር ሳጥን የተባለ "ዝርዝር ሳጥን1"

ተስማሚ መሆኑን እርግጠኛ ይሁኑ የ ላይኛው ጉዳይ ፊደል እና የ ታችኛው ጉዳይ ፊደል ጋር እርስዎ በሚያያይዙ ጊዜ መቆጣጠሪያ ለ ተለዋዋጭ እቃ

### አለም አቀፍ ተግባር ንግግሮችን ለ መጫን

    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 display model properties for the control CheckBox1
        oCheckBox1Model = oDialog1Model.CheckBox1
        MsgBox oCheckBox1Model.Dbg_Properties
        REM set new state for CheckBox1 for model of control
        oCheckBox1Model.State = 1
        REM display model properties for control CommandButton1
        oCMD1Model = oDialog1Model.CommandButton1
        MsgBox oCMD1Model.Dbg_Properties
        REM display properties of control CommandButton1
        oCMD1 = oDialog1.GetControl("CommandButton1")
        MsgBox oCMD1.Dbg_Properties
        REM execute dialog
        oDialog1.Execute()
    End Sub

### ወደ ዝርዝር ሳጥን ውስጥ ማስገቢያ መጨመሪያ

    Sub AddEntry
        With GlobalScope.Basiclibraries
           If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
        End With
        oDialog1 = ModuleControls.LoadDialog("Standard", "Dialog1")
        REM adds a new entry to the 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 remove the first entry from the ListBox
        oDialog1Model = oDialog1.Model
        oListBox = oDialog1.GetControl("ListBox1")
        oListbox.removeitems(0,1)
    End Sub

የ ተዛመዱ አርእስቶች

የ መቆጣጠሪያ ባህሪዎችን መቀየሪያ በ ንግግር ማረሚያ ውስጥ

መሰረታዊ ንግግር መፍጠሪያ

በ ንግግር ማረሚያ ውስጥ መቆጣጠሪያዎች መፍጠሪያ

Opening a Dialog With Basic

Please support us!