event OffsetChanged (Horizontal as Boolean, NewVal as Long)

Occurs when the scroll position has been changed.

 TypeDescription 
   Horizontal as Boolean A boolean expression that indicates whether the horizontal or vertical scroll bar is changed.  
   NewVal as Long A long value that indicates the new scroll bar value.  

The event OffsetChanged is not fired if the control's list has no scroll bars. The control adds automatically scroll bars to the control when required. The OffsetChanged event notifies your application that user changes the position of one of the control's scroll bars. The OversizeChanged event notifies your application that the range of control's scroll bar is changed.

The following VB sample displays the new scroll position when user scrolls horizontally the control:

Private Sub ComboBox1_OffsetChanged(ByVal Horizontal As Boolean, ByVal NewVal As Long)
    If (Horizontal) Then
        Debug.Print "The horizontal scroll bar has been moved to " & NewVal
    End If
End Sub

The following VC sample displays the new scroll position when the user scrolls vertically the control:

void OnOffsetChangedCombobox1(BOOL Horizontal, long NewVal) 
{
	if ( !Horizontal )
	{
		CString strFormat;
		strFormat.Format( "NewPos = %i\n", NewVal );
		OutputDebugString( strFormat );
	}
}

The following VB.NET sample displays the new scroll position when the user scrolls vertically the control:

Private Sub AxComboBox1_OffsetChanged(ByVal sender As Object, ByVal e As AxEXCOMBOBOXLib._IComboBoxEvents_OffsetChangedEvent) Handles AxComboBox1.OffsetChanged
    If (Not e.horizontal) Then
        Debug.WriteLine(e.newVal)
    End If
End Sub

The following C# sample displays the new scroll position when the user scrolls vertically the control:

private void axComboBox1_OffsetChanged(object sender, AxEXCOMBOBOXLib._IComboBoxEvents_OffsetChangedEvent e)
{
	if ( !e.horizontal )
		System.Diagnostics.Debug.WriteLine(e.newVal);
}

The following VFP sample displays the new scroll position when the user scrolls vertically the control:

*** ActiveX Control Event ***
LPARAMETERS horizontal, newval

if ( 0 # horizontal )
	wait window nowait str( newval )
endif


Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.