>>-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.
The arguments are:
The ID of the slider control of which a notification is to be connected to a method.
The event to be connected with a method:
The Up or right key has been pressed.
The Down or left key has been pressed.
The Home key has been pressed.
The End key has been pressed.
The PgUp key has been pressed.
The PgDn key has been pressed.
The slider has been moved.
The left mouse button has been released, following a DRAG notification.
The slider movement is completed, that is, the appropriate key or mouse button has been released.
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.
The return codes are:
No error detected.
The resource ID could not be resolved or the event argument is incorrect.
The messages was not connected correctly.
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 is to 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 = ev_pos % "10000"~x2d say "Pos=" pos ", event code to verify=" BinaryAnd(ev_pos, , "0x0000FFFF") "(expected 4)"
Notes:
The method can only be called after the slider was created by Windows. A good location for this connection is the InitDialog method.
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 = ev_pos % "10000"~x2d