AsifMughal
asked on
Problem with Rectangular slide bar on scroll bar of list box
hello All
I have two List Boxes of type ClistBox. One of the listboxes is just for titles while the other contains the data and a horizontal scroll bar. I am trying to move the titles in the title listbox when the user clicks onto the scroll bar of the data listbox. The horizontal scroll bar is working when the user clicks on the arrow of the scroll bar but DOES NOT work when the user click drags the rectangular slide bar on the scroll bar. The code is as follows:
CListBox m_ctlTitleList;
CBrowseList m_ctlPatientList;
The CbrowseList class code is as follows:
// brwslist.cpp : implementation file
//
#include "StdAfx.h"
#include "Patient.h"
#include "BrwsList.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CBrowseList
CBrowseList::CBrowseList()
{
m_ctlTitle = NULL;
}
CBrowseList::~CBrowseList( )
{
}
BEGIN_MESSAGE_MAP(CBrowseL ist, CListBox)
//{{AFX_MSG_MAP(CBrowseLis t)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CBrowseList message handlers
void CBrowseList::SetTitle( CListBox* aControl )
{
m_ctlTitle = aControl;
}
void CBrowseList::OnHScroll(UIN T nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
/*if (nSBCode == SB_THUMBTRACK)
return;*/
if (m_ctlTitle)
if ((nSBCode == SB_THUMBPOSITION) || (nSBCode == SB_THUMBTRACK)) {
m_ctlTitle->SetScrollPos( SB_HORZ, nPos, TRUE );
} else
m_ctlTitle->SendMessage( WM_HSCROLL, MAKEWORD(nSBCode, nPos), NULL);
/* if ((nSBCode == SB_THUMBTRACK) || (nSBCode == SB_ENDSCROLL))
return; // eat it
*/
CListBox::OnHScroll(nSBCod e, nPos, pScrollBar);
}
I look forward to a reply.
Best Regards
Asif
I have two List Boxes of type ClistBox. One of the listboxes is just for titles while the other contains the data and a horizontal scroll bar. I am trying to move the titles in the title listbox when the user clicks onto the scroll bar of the data listbox. The horizontal scroll bar is working when the user clicks on the arrow of the scroll bar but DOES NOT work when the user click drags the rectangular slide bar on the scroll bar. The code is as follows:
CListBox m_ctlTitleList;
CBrowseList m_ctlPatientList;
The CbrowseList class code is as follows:
// brwslist.cpp : implementation file
//
#include "StdAfx.h"
#include "Patient.h"
#include "BrwsList.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
//////////////////////////
// CBrowseList
CBrowseList::CBrowseList()
{
m_ctlTitle = NULL;
}
CBrowseList::~CBrowseList(
{
}
BEGIN_MESSAGE_MAP(CBrowseL
//{{AFX_MSG_MAP(CBrowseLis
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////
// CBrowseList message handlers
void CBrowseList::SetTitle( CListBox* aControl )
{
m_ctlTitle = aControl;
}
void CBrowseList::OnHScroll(UIN
{
/*if (nSBCode == SB_THUMBTRACK)
return;*/
if (m_ctlTitle)
if ((nSBCode == SB_THUMBPOSITION) || (nSBCode == SB_THUMBTRACK)) {
m_ctlTitle->SetScrollPos( SB_HORZ, nPos, TRUE );
} else
m_ctlTitle->SendMessage( WM_HSCROLL, MAKEWORD(nSBCode, nPos), NULL);
/* if ((nSBCode == SB_THUMBTRACK) || (nSBCode == SB_ENDSCROLL))
return; // eat it
*/
CListBox::OnHScroll(nSBCod
}
I look forward to a reply.
Best Regards
Asif
ASKER
Thanks for your reply. I can't find any information on the GetScrollInfo and on the LVM_SCROLL message in any of the reference books. I would be grateful if you could send me some sample code or recommend any articles.
Thanks in advance
Asif
Thanks in advance
Asif
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should use LVM_SCROLL messages.
Regards,
Asker.