Skip to content

AddSliderPane Method

Description

Adds a slider pane to the status bar.

Syntax

Public Function AddSliderPane( _
    ByVal [Id](#) As Long _
) As [StatusBarSliderPane](XtremeCommandBars~StatusBarSliderPane.md)

Parameters

  • Id: Id of the pane.

Return Type

Reference to the StatusBarSliderPane that was added to the status bar.

Remarks

AddSliderPane adds a slider pane to the status bar. The Max and Min values should be set after creation to specify the maximum and minimum values that the slider will use.

Slider Pane Example

Notes

  • The SliderPaneClick event occurs when a slider pane has been clicked. The current position of the thumb tracker is retrieved as well as how the slider was moved (clicked on button, thumb tracker, line, etc).
  • The SliderPaneClick event can be used to update the Value of the slider. The Value will need to be manually maintained each time the slider is clicked. A value from the XTPSliderCommand enumeration will be passed to the SliderPaneClick event which specifies where the user clicked on the slider (clicked on button, thumb tracker, line, etc) and the current position of the thumb tracker.

Example

' Variable in global code section  
Dim ViewZoom As Long  

' Code to add slider  
Dim SliderPane As StatusBarSliderPane  
Set SliderPane = StatusBar.AddSliderPane(ID_INDICATOR_ZOOMSLIDER)  
SliderPane.Width = 130  
SliderPane.ToolTip = "Zoom"  
SliderPane.Min = 0  
SliderPane.Max = 200  
SliderPane.Value = 100  
SliderPane.Caption = "&Zoom Slider"  
SliderPane.BeginGroup = False  
ViewZoom = 100  

Private Sub StatusBar_SliderPaneClick(ByVal Pane As XtremeCommandBars.StatusBarSliderPane, ByVal Command As XtremeCommandBars.XTPSliderCommand, ByVal Pos As Long)  
    Dim nZoom As Long  
    nZoom = ViewZoom  

    Select Case Command  
        Case XTP_SB_LEFT: nZoom = 0  
        Case XTP_SB_RIGHT: nZoom = 200  
        Case XTP_SB_LINELEFT: nZoom = Max((Int(nZoom / 10) - 1) * 10, 0)  
        Case XTP_SB_LINERIGHT: nZoom = Min((Int(nZoom / 10) + 1) * 10, 200)  
        Case XTP_SB_THUMBTRACK: nZoom = Pos  
        Case XTP_SB_PAGELEFT: nZoom = Max(nZoom - 20, 0)  
        Case XTP_SB_PAGERIGHT: nZoom = Min(nZoom + 20, 200)  
    End Select  

    If (nZoom = ViewZoom) Then Exit Sub  

    ViewZoom = nZoom  
    Pane.Value = nZoom  
    StatusBar.FindPane(ID_INDICATOR_ZOOM).Text = nZoom & "%"  
End Sub  

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.