Pager Control

The class CCJPagerCtrl is fairly simple to use. It can be used in either a dialog or view. For demo purposes, I implemented it in a dialog using a CToolBar, but you can use any control or view class as the child window. Open your dialog in your resource editor and add a custom control. Modify the properties of the control as shown below:

In the OnInitDialog() section, add the following code:

// TODO: Add extra initialization here
if (!m_wndToolBar.Create(&m_Pager) ||
	!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
	TRACE0("Failed to create toolbar\n");
	return -1;      // fail to create
}

// Make the toolbar flat.
m_wndToolBar.ModifyStyle(0, 0x0800);

// Set the child HWND.
m_Pager.SetChild(m_wndToolBar.m_hWnd);

// Set the pager style to PGS_HORZ.
m_Pager.ModifyStyle(0,PGS_HORZ);

// Set the button size to 15.
m_Pager.SetButtonSize(15);

// Determine size of child
SIZE Size;
m_wndToolBar.SendMessage(TB_GETMAXSIZE,0,(LPARAM)&Size);

// Set the scroll area for pager.
m_Pager.SetScrollArea(Size.cx+15, Size.cy+15);

NOTE:
If you are using Visual C++ 5, you will need to include the support file comm_control.h in your project, unless you have installed the SDK, in which case you won't need this. If you have any questions, feel free to drop me a line.

Download demo project - 23 KB

Download source - 5 KB



Comments

  • THE ARTICLE AND SOURCE CODE ARE OUTDATED, PLEASE FOLLOW THIS LINK FOR THE LATEST UPDATE

    Posted by Legacy on 09/12/1999 12:00am

    Originally posted by: Kirk Stowell

    Hello,

    Until I am able to update this article, as an alternative, please visit this link http://www.codejock.com/ for the latest updates. My email address has changed also, please respond to kstowell@codejock.com...

    Thanks,
    Kirk Stowell

    Reply
  • Problems with the PGN_SCROLL notification message

    Posted by Legacy on 08/25/1999 12:00am

    Originally posted by: George Parlantzas

    Why are always the iDir (scroll direction) and iScroll (scroll delta) members of the NMPGSCROLL structure empty ?

    Is it a bug of the pager common control (note: it makes no difference if you use ComCtl32.dll version 4.72 or 5.80) ?

    Reply
  • Frame Window

    Posted by Legacy on 06/01/1999 12:00am

    Originally posted by: Sergiy

    I've tried to use your class in frame not dialog window, but failed. Could you provide a sample?

    Reply
  • Prb: Trying to work with Bcgpopupmenu, problems

    Posted by Legacy on 01/25/1999 12:00am

    Originally posted by: amish

    hi kirk,

    i was trying to use this with the BCGPopupmenu(extention dll - bcgcontrolbar)but doesnt work properly, the arrows and the menu items do not appear only, can u help me out?? Bcgpopupmenu is derived from miniframewnd.

    -amish

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Webinar on September 23, 2014, 2 p.m. ET / 11 a.m. PT Mobile commerce presents an array of opportunities for any business -- from connecting with your customers through mobile apps to enriching operations with mobile enterprise solutions. Join guest speaker, Michael Facemire, Forrester Research, Inc. Principal Analyst, as he discusses the new demands of mobile engagement and how application program interfaces (APIs) play a crucial role. Check out this upcoming webinar to learn about the new set of …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds