ConnectSliderNotify

>>-aMessageExtensions~ConnectSliderNotify(--id--,--"--+-UP-------+--"-->
                                                      +-DOWN-----+
                                                      +-TOP------+
                                                      +-BOTTOM---+
                                                      +-PAGEUP---+
                                                      +-PAGEDOWN-+
                                                      +-DRAG-----+
                                                      +-POSITION-+
                                                      +-ENDTRACK-+

>--+---------------+--)----------------------------------------><
   +-,--msgToRaise-+


The ConnectSliderNotify method connects a particular WM_NOTIFY message for a slider control, which is also called a track bar, with a method. The WM_NOTIFY message informs the dialog that an event has occurred with regard to the slider control.

Arguments:

The arguments are:

id

The ID of the slider control of which a notification is to be connected to a method.

event

The event to be connected with a method:

UP

The Up or right key has been pressed.

DOWN

The Down or left key has been pressed.

TOP

The Home key has been pressed.

BOTTOM

The End key has been pressed.

PAGEUP

The PgUp key has been pressed.

PAGEDOWN

The PgDn key has been pressed.

DRAG

The slider has been moved.

POSITION

The left mouse button has been released, following a DRAG notification.

ENDTRACK

The slider movement is completed, that is, the appropriate key or mouse button has been released.

msgToRaise

The message that is to be sent whenever the specified notification is received from the slider control. Provide a method with a matching name. If you omit this argument, the event is preceded by On.

Return value:

The return codes are:

0

No error detected.

-1

The resource ID could not be resolved or the event argument is incorrect.

1

The messages was not connected correctly.

Example:

The following example connects the POSITION event (release mouse button after dragging) with method PosSet, which extracts the new slider position from the notification arguments and displays it together with the event type for POSITION, which should be 4:

::class MyDlgClass subclass UserDialog inherit MessageExtensions

::method InitDialog
  self~InitDialog:super(...)
  self~ConnectSliderNotify("MYSLIDER", "POSITION", PosSet)

::method PosSet
  use arg ev_pos, hnd
  pos = .DlgUtil~hiWord(ev_pos)

  say "Verify event code (should be 4):" .DlgUtil~loWord(ev_pos)

Notes:

  1. The method can only be called after the slider was created by Windows. A good location for this connection is the InitDialog method.

  2. The event-handling methods receive two arguments: an event-position pair and the handle to the slider control. For some events, you can retrieve the slider position by extracting the high-oder word. Example:

    ::method Handler
      use arg ev_pos, handle
      position = .DlgUtil~hiWord(ev_pos)