06-09-2005, 11:51 AM
I found this, but I don't know how do it in QM:
"the solution is LineScroll().
create CEdit derived class, say CCustomEdit;
declare in your dialog 2 CEdit control from the new type:
CCustomEdit m_edit1, m_edit2;
override EN_VSCROLL for both of the control, as follow:
BEGIN_MESSAGE_MAP(CCustomEdit, CEdit)
ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll)
.
.
END_MESSAGE_MAP()
void CCustomEdit ::OnVscroll()
{
//the code comes here
}
also, since u wanna send a manually scrolling message to the 2nd CEdit u wanna add a function which recieve the CEdit control which is being scrolled and scroll manually the 2nd one, u can use their handle in order to distinguish between them:
void CMyDialog:
oScroll(HWND hEditHandle, int lineIndex)
{
//first CEdit has been scrolled, now scroll the 2nd one
if(m_edit1.m_hWnd == hEditHandle)
{
ASSERT(lineIndex>-1 && lineIndex<m_edit2.GetLineCount());
m_edit2.LineScroll(lineIndex);
}
//second CEdit has been scrolled, now scroll the 1st one
else
{
ASSERT(lineIndex>-1 && lineIndex<m_edit1.GetLineCount());
m_edit1.LineScroll(lineIndex);
}
now in the derived CEdit u implem,ent OnVScroll like thats:
void CCustomEdit ::OnVscroll()
{
//call DoScroll of the parent dialog with the handle and line index:
((CMyDialog*)GetParent())->DoScroll(m_hWnd, LineIndex);
}
"
"the solution is LineScroll().
create CEdit derived class, say CCustomEdit;
declare in your dialog 2 CEdit control from the new type:
CCustomEdit m_edit1, m_edit2;
override EN_VSCROLL for both of the control, as follow:
BEGIN_MESSAGE_MAP(CCustomEdit, CEdit)
ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll)
.
.
END_MESSAGE_MAP()
void CCustomEdit ::OnVscroll()
{
//the code comes here
}
also, since u wanna send a manually scrolling message to the 2nd CEdit u wanna add a function which recieve the CEdit control which is being scrolled and scroll manually the 2nd one, u can use their handle in order to distinguish between them:
void CMyDialog:
oScroll(HWND hEditHandle, int lineIndex){
//first CEdit has been scrolled, now scroll the 2nd one
if(m_edit1.m_hWnd == hEditHandle)
{
ASSERT(lineIndex>-1 && lineIndex<m_edit2.GetLineCount());
m_edit2.LineScroll(lineIndex);
}
//second CEdit has been scrolled, now scroll the 1st one
else
{
ASSERT(lineIndex>-1 && lineIndex<m_edit1.GetLineCount());
m_edit1.LineScroll(lineIndex);
}
now in the derived CEdit u implem,ent OnVScroll like thats:
void CCustomEdit ::OnVscroll()
{
//call DoScroll of the parent dialog with the handle and line index:
((CMyDialog*)GetParent())->DoScroll(m_hWnd, LineIndex);
}
"
