Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scroll edit dialog
#3
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:Big GrinoScroll(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);

}
"


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)