DlgValue Instruction/Function

Syntax:

DlgValue DlgItem|$, Value

-or-

DlgValue(DlgItem|$)

Group: Dialog Function

Description:
Instruction: Set the numeric value DlgItem|$.

Function: Return the numeric value for DlgItem|$.

This instruction/function must be called directly or indirectly from a dialogfunc. The DlgItem|$ should refer to a check box, ComboBox, DropListBox, ListBox or OptionGroup.

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.

Example:

Sub Main
  Begin Dialog UserDialog 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
  End Dialog
 
  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
  End Select
  End Select
End
Function