Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scroll edit dialog
#1
How scroll Edit3=Edit4; Edit4=edit3

Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54330180 0x200 6 6 86 80 ""
;4 Edit 0x54330180 0x200 98 6 86 80 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010601 "" ""

ret
;messages
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam); ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
int ctrlid=wParam&0xFFFF; message=wParam>>16
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
#2
Scroll synchronously edit4 when you scroll edit3, and edit3 when you scroll edit4? I don't know. Maybe subclass edit controls to intercept WM_VSCROLL messages, and send WM_VSCROLL to other control.
#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);

}
"
#4
http://www.quickmacros.com/forum/showthread.php?tid=462
#5
Perfect. Thank you.


Forum Jump:


Users browsing this thread: 1 Guest(s)