OnOk Method (InputDlg)

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 17:09

Description

Performs validation? WORK IN PROGRESS / missing examples

Syntax

dlg.OnOK

Example

  Public Shared Function OpenTxtSaveSelToArticleDlgBase(ByVal open As Boolean, _

                                                        ByRef openArticle As BooleanByRef addElement As Boolean, _

                                                        ByRef ElemTypeId As IntegerByRef PasteOption As Integer, _

                                                        Optional ByVal allowCreate As Boolean = FalseOptional ByVal searchValue As String = NothingAs Integer

    Dim title, baseQuery, dirStyle, groupName As String

    If open Then

      title = My.Resources.IDS_OpenArticle '"Open Article"

    Else

      title = My.Resources.IDS_SelectArticle '"Select Article"

    End If

    baseQuery = "ArticlePicker"

    dirStyle = My.Resources.IDS_ListDirStyleName

    groupName = "NewSelectObjDialog"

 

    Dim result As Nullable(Of Boolean)

    Dim custom As InputDlg = New InputDlg()

 

    custom.AddInfo(My.Resources.IDS_INS_SELOPTIONS, 1) '0

    Dim coTypes As InputDlg.Combo = New InputDlg.Combo()

 

    Dim types As System.Collections.Generic.List(Of IdName) = New System.Collections.Generic.List(Of IdName)

    TedApp.ListValidTypes(types, False)

    For Each typ As IdName In types

      coTypes.AddItem(typ.Name, typ.Id)

    Next

 

    custom.AddCombo(My.Resources.IDS_ELE_TYPE, coTypes, 0) '1

 

    custom.AddSwitch(String.Empty, My.Resources.IDS_ADDELE, True'2

    custom.AddSwitch(String.Empty, My.Resources.IDS_OPENART, False'3

 

    Dim combo2 As InputDlg.Combo = New InputDlg.Combo()

    combo2.AddItem(My.Resources.IDS_REPLACE, 1)

    combo2.AddItem(My.Resources.IDS_PREPEND, 2)

    combo2.AddItem(My.Resources.IDS_APPEND, 3)

    custom.AddCombo(My.Resources.IDS_INS_OPTIONS, combo2, 0) '4

 

    Dim searchConditionsRes As ShellSearchConditions = Nothing

    Dim res As List(Of Integer) = OpenDlgBase(ApplicationBase.Current.MainWindow, title, baseQuery, dirStyle, groupName, Nothing,

      True, allowCreate, searchValue, result, custom, NothingNothing, searchConditionsRes)

    If (result = TrueThen

      custom.OnOK()

      ElemTypeId = types(custom.GetComboIdx(1)).Id

      addElement = (DirectCast(custom.GetItemValue(2), Boolean))

      openArticle = (DirectCast(custom.GetItemValue(3), Boolean))

      PasteOption = custom.GetComboIdx(4)

      Return res(0)

    End If

    Return 0

  End Function

 

  Shared Function ValidateSavedSearchName(ByVal dlg As InputDlgAs Boolean

    Dim searchName As String = dlg.GetItemValue(0).ToString()

 

    If String.IsNullOrWhiteSpace(searchName.Trim()) Then

      MessageBox.Show(dlg, My.Resources.STR_SAVED_SEARCH_NAME_ERROR, dlg.Title)

      Return False

    End If

 

    Return True

  End Function