DlgValue Instruction/Function

Syntax:

DlgValue DlgItem,Value

-or-

DlgValue(DlgItem)

Group:

Dialog Function

Description: 

Instruction: Set the numeric value(S) DlgItem.
Function: Return the numeric value for(S) DlgItem. (A MultiListBox user dialog item returns an array.)
This instruction/function must be called directly or indirectly from a dialogfunc. The DlgItem should refer to a CheckBox, ComboBox, DropListBox, ListBox or OptionGroup.

Parameters:

Parameter

Description

DlgItem

If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name.

Text Set the text of DlgItem to this string value.

Value

Set the text of DlgItem to this numeric value. (A MultiListBox user dialog item uses an array.)

ExampleS:

Sub Main
  Begin DialogUserDialog 150,147,.DialogFunc
  GroupBox 10,7,130,77,"Direction",.Field1
  PushButton 100,28,30,21,"&Up"
  PushButton 100,56,30,21,"&Dn"
  OptionGroup .Direction
  OptionButton 20,21,80,14,"&North",.North
  OptionButton 20,35,80,14,"&South",.South
  OptionButton 20,49,80,14,"&East",.East
  OptionButton 20,63,80,14,"&West",.West
  OKButton 10,91,130,21
  CancelButton 10,119,130,21
  EndDialog
  Dim dlg As UserDialog
  Dialog dlg
  MsgBox "Direction=" & dlg.Direction
End
Sub

Function DialogFunc%(DlgItem$, Action%, SuppValue%)
  Select Case Action%
  Case 1 ' Dialog box initialization
  Beep
  Case 2 ' Value changing or button pressed
  Select Case DlgItem$
  Case "Up"
  DlgValue "Direction",0
  DialogFunc% = True 'do not exit the dialog
  Case "Dn"
  DlgValue "Direction",1
  DialogFunc% = True 'do not exit the dialog
  EndSelect
  EndSelect
End
Function

See Also:

DlgValue, DlgVisible, DlgControlId, DlgCount, DlgName, DlgNumber, DlgType