Module
Contents
Index 🔎︎

# Programming Examples for Controls in the Dialog Editor

The following examples are for a new dialog 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".

Budite dosljedni pri pisanju velikih i malih slova kada prilažete kontrolu varijabli objekta.

### Globalne funkcije dijaloških okvira za učitavanje

    Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)

    Dim oLib as Object

    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

### Prikaz dijaloških okvira

    REM globalne definicije varijabli

    Dim oDialog1 AS Object

    Sub StartDialog1

        BasicLibraries.LoadLibrary("Tools")

        oDialog1 = LoadDialog("Standard", "Dialog1")

        oDialog1.Execute()

    End Sub

### Čitaj ili uredi svojstva kontrola u Programu

    Sub Sample1

        BasicLibraries.LoadLibrary("Tools")

        oDialog1 = LoadDialog("Standard", "Dialog1")

        REM dohvati model dijaloga

        oDialog1Model = oDialog1.Model

        REM prikaži tekst Label1

        oLabel1 = oDialog1.GetControl("Label1")

        MsgBox oLabel1.Text

        REM postavi novi tekst za kontrolu Label1

        oLabel1.Text = "New Files"

        REM prikaz svojstva modela za kontrolu CheckBox1

        oCheckBox1Model = oDialog1Model.CheckBox1

        MsgBox oCheckBox1Model.Dbg_Properties

        REM postavi novo stanje za CheckBox1 za model ili kontrolu

        oCheckBox1Model.State = 1

        REM prikaz svojstva modela za kontrolu CommandButton1

        oCMD1Model = oDialog1Model.CommandButton1

        MsgBox oCMD1Model.Dbg_Properties

        REM svojstva prikaza za CommandButton1

        oCMD1 = oDialog1.GetControl("CommandButton1")

        MsgBox oCMD1.Dbg_Properties

        REM izvršni dijaloški okvir

        oDialog1.Execute()

    End Sub

### Dodavanje stavke u okvir popisa

    Sub AddEntry

        BasicLibraries.LoadLibrary("Tools")

        oDialog1 = LoadDialog("Standard", "Dialog1")

        REM unosi novu stavku u okvir popisa

        oDialog1Model = oDialog1.Model

        oListBox = oDialog1.GetControl("ListBox1")

        Dim iCount as integer

        iCount = oListbox.ItemCount

        oListbox.additem("New Item" & iCount,0)

    End Sub

### Ukloni stavku iz okvira popisa

    Sub RemoveEntry

        BasicLibraries.LoadLibrary("Tools")

        oDialog1 = LoadDialog("Standard", "Dialog1")

        REM ukloni prvu stavku iz okvira popisa

        oDialog1Model = oDialog1.Model

        oListBox = oDialog1.GetControl("ListBox1")

        oListbox.removeitems(0,1)

    End Sub

Related Topics

Promjena svojstava kontrola i dijaloškog uređivača

Stvaranje Basic dijaloga

kreiranje kontrola u dijaloškom uređivaču

Opening a Dialog With Program Code