Click here to Skip to main content
13,556,345 members
Click here to Skip to main content
Add your own
alternative version


39 bookmarked
Posted 11 Jan 2000

CWndSliderView - An animated child window manager

, 11 Jan 2000
Rate this:
Please Sign up or sign in to vote.
An article on using an Outlook style window slider control.
  • Download demo project - 71 Kb
  • Download source files - 28 Kb

    Sample Image - CWndSlider.jpg

    <!-- Article Starts -->


    This is yet another control inspired from the Outlook shortcut-bar.  The CWndSliderView control is pretty much (to put it simply) a child window manager, with fancy looking buttons and a cool sliding window animation effect.  The control was created to be rather simple and self explanatory.  I have done my best to heavily comment CWndSliderView's source code.  Hopefully everyone who views my code will find it useful and or educational.  Have fun!

    Setting up and using the CWndSliderView control

    First create an instance of CWndSliderView in the Main Frame of your application.  On CMainFrame::OnCreate, get a pointer to the context information and the CWndSliderView.  To create a new child view, call CWndSliderView::Create with the new child views title, RUNTIME_CLASS pointer, and create context parameters.  CWndSliderView::Create returns SOB_ERROR on error; otherwise the index of newly created view.  Use CWndSlider::ModifyViewStyle to make child views animate vertically or horizontally.  That's pretty much it.  It's all simple.

    #include "WndSlider.h"
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    	//  ...[SNIP]...
    	// Get the Create Context struct.
    	CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
    	// Grab the main CWndSliderView windows.  
    	CWndSliderView *pObar = STATIC_DOWNCAST( CWndSliderView, m_wndSplitter.GetPane(0,0) );
    	// Check for NULL...
    	if( NULL != pObar )
    		int nID;
    		// Modify the default button style to be vertical...
    		pObar->ModifyBarStyle( SOB_BAR_HORZ, SOB_BAR_VERT, FALSE );	
    		// Start adding views to the slider...  
    		nID = pObar->CreateView( _T("0 CMyListView 0"), RUNTIME_CLASS(CMyListView), pContext );
    		// Debug-check if view creation worked without error...
    		ASSERT( SOB_ERROR != nID );
    		// Add a simple CEditView to the CWndSliderView window.
    		nID = pObar->CreateView( _T("1 CEditView 1"), RUNTIME_CLASS(CEditView), pContext );
    		// Debug-check if view creation worked without error...
    		ASSERT( SOB_ERROR != nID );
    		// Continue adding more views if you like...
    	//  ...[SNIP]...

    Constants Defined 

      SOB_VIEW_DEFAULT_BTN_HEIGHT : Increase or decrease to change default button height (VALUE = 24 pixels).<BR>SOB_VIEW_DEFAULT_ANIMATION_SPEED :Increase or decrease to change animation step speed (VALUE = 10 ms).
      SOB_VIEW_DEFAULT_ANIMATION_LIMIT : Increase or decrease value to to limit the total amount of time spent animating (VALUE = 200 ms).

      SOB_VIEW_HORZ : Set view style bit to have child windows animate horizontally (DEFAULT).<BR>SOB_VIEW_VERT : Set view style bit to have child windows animate vertically.
      SOB_VIEW_ANIMATE : Set view style bit to turn on child window animation (DEFAULT). 

      SOB_BTN_ANIMATE : Set button style bit to turn on animation (DEFAULT) - used to turn off animation per child window. 
      SOB_BTN_FANCYFACE : Set button style bit to turn on 3D fancy face surface (DEFAULT).

      Comments, suggestions, and notes

      CWndSliderView is just the sliding / animating component of a "Outlook Bar."  Perhaps someday in the future when I have some free time, I'll work on a real  "Outlook Bar" looking control.  Until then...  If anyone has comments, suggestions, or questions please feel free to send me a quick message. 

    • License

      This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

      A list of licenses authors might use can be found here


      About the Author

      Christopher Brown
      United States United States
      No Biography provided

      You may also be interested in...


      Comments and Discussions

      QuestionDialog-based program? Pin
      mingluen12-Dec-04 23:15
      membermingluen12-Dec-04 23:15 
      AnswerRe: Dialog-based program? Pin
      zstcheng7-Jun-06 20:47
      memberzstcheng7-Jun-06 20:47 
      Generalrendering bug Pin
      Jan1101197728-Jun-04 5:52
      memberJan1101197728-Jun-04 5:52 
      GeneralZer gut! Pin
      ThEN12-Feb-02 23:57
      memberThEN12-Feb-02 23:57 
      GeneralNot created in case of CFormView Pin
      Namkyeong Lee28-Jan-02 5:12
      memberNamkyeong Lee28-Jan-02 5:12 
      GeneralRe: Not created in case of CFormView Pin
      Warren Gardner6-Dec-02 3:55
      memberWarren Gardner6-Dec-02 3:55 
      GeneralSuggestion Pin
      Noman Nadeem19-Sep-01 2:41
      memberNoman Nadeem19-Sep-01 2:41 
      GeneralTwo Comments Pin
      Anonymous17-Aug-01 10:55
      memberAnonymous17-Aug-01 10:55 
      Generaloutlook bar Pin
      vinayb1318-Jul-01 9:20
      membervinayb1318-Jul-01 9:20 
      GeneralMessage Closed Pin
      12-Jan-00 18:40
      sussPaul Selormey12-Jan-00 18:40 

      General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

      Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

      Permalink | Advertise | Privacy | Terms of Use | Mobile
      Web03-2016 | 2.8.180515.1 | Last Updated 12 Jan 2000
      Article Copyright 2000 by Christopher Brown
      Everything else Copyright © CodeProject, 1999-2018
      Layout: fixed | fluid