AddCombo Method

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

Description

Ends combo box sequence and selects an item with specified index.

It should be called when the items are already added by AddItem. After it is shown, use either GetComboIdx to read the index of item selected in the list, or GetComboStr to read the name of the item, or GetComboData to read the value of the selected item.

Syntax

dim po = object.AddCombo(strLabel, combo, intIdx)

object

Required. Object name, returned by Dim idlg As InputDlg = New InputDlg.

strLabel

Label as it appears in the dialog.

combo

name of the combo, as defined with Dim combo As InputDlg.Combo = New InputDlg.Combo.

intIdx

Index of item in the combo to be selected when the combo is displayed. Should you want to select by combo value and not by position, use combo.ToIdx(value) instead of intIdx.

Note: the method may return the object (above po), or you can use it without it, and then refer to it with the ordinal number of the control in the dialog (the first displayed control has number 0, the second is 1 and so on

Example

Dim idlg As InputDlg = New InputDlg

idlg.Title = My.Resources.IDS_FITTXTPTH

 

Dim combo As InputDlg.Combo = New InputDlg.Combo

combo.AddItem("Above", 0)

combo.AddItem("Below", 1)

Dim po = idlg.AddCombo("Position", combo, SystemUserOptions.TTP_Pos)

Dim di = idlg.AddInt("Distance (in pt)", SystemUserOptions.TTP_Dist)

Dim sp = idlg.AddSwitch("Spread", "Enabled", SystemUserOptions.TTP_Spread)

Dim de = idlg.AddSwitch("Delete", "Enabled", SystemUserOptions.TTP_Del)

 

If idlg.ShowDialog() Then

  SystemUserOptions.TTP_Pos = idlg.GetComboData(po)

  SystemUserOptions.TTP_Dist = idlg.GetItemValue(di)

  SystemUserOptions.TTP_Spread = idlg.GetItemValue(sp)

  SystemUserOptions.TTP_Del = idlg.GetItemValue(de)

  DoTxtToPath(SystemUserOptions.TTP_Pos, SystemUserOptions.TTP_Dist, SystemUserOptions.TTP_Spread, SystemUserOptions.TTP_Del)

End If

See also

AddDateTime, AddInt, AddString, AddSwitch

ComboAddItem, Show