advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Change Event Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 SUB ctlname_Change ([Index AS INTEGER])
 
 Usage Notes
   ■ A Change event procedure synchronizes or coordinates the data displayed
     between controls. For instance, you can write a Change event procedure
     for a scroll bar so that it updates a label that displays the scroll
     bar's Value property. Or, you might use a Change event procedure to
     display data and formulas in a work area and results in another area.
 
   ■ Change event procedures are also useful for updating properties in file-
     system controls. For example, you can update the Path property for a
     directory list box to reflect a change in a drive list box's Drive
     property.
 
   ■ How and when a Change event occurs varies with the control:
 
     Control             Description
     ══════════════════  ═══════════════════════════════════════════════════
     Combo box           Occurs when the user enters data or changes the
                         contents of a Dropdown Combo (Style = 0), or a
                         Simple Combo (Style = 1)
     Text box            Occurs when the user enters data or when the Text
                         property is changed in code
     Directory list box  Occurs when the user selects a new directory, or
                         when the Path property is changed in code
     Drive list box      Occurs when the user selects a new drive or when
                         the Drive property is changed in code
     Scroll bars         Occurs when the user scrolls or when the Value
                         property is changed in code
     Label               Occurs when the Caption property is changed in code
 
   ■ A Change event procedure can sometimes cause a cascading event. This
     event occurs when the control's Change event alters the control's
     contents - for example, by setting a property in code that determines
     the control's value, such as the Text property setting for a text box.
     To prevent a cascading event:
     • If possible, avoid writing a Change event procedure for a control that
       alters that control's contents. Otherwise, set a flag variable that
       blocks out further changes while the current change is in progress.
     • Avoid creating two or more controls whose Change event procedures
       mutually affect each other - for example, two text boxes that update
       each other.