-
Edit Control Questions
I have two questions. The first is how would I make a set of Edit Controls with Scrollbars scroll simultaneously? I'd like to even have a scrollbar on each one and hve them scroll at the same time no matter which one I use. What message would I use?
Oh, and is it possible to create an edit box that is editable only by the program or should I just use a Listbox?
-
Wm_vscroll
MSDN WM_VSCROLL .
Just intercept this message through your windowproc, use GetScrollPos to get where one control is at and use SetScrollPos to set the second scrollbar.
Code:
case WM_VSCROLL: {
int nScrlPos;
/*
Get Scroll Bar Position
lParam is the Handle of the control sending the position
*/
nScrlPos = GetScrollPos(lParam, SB_VERT);
/*
Set the sister control scroll bar to the same position
Remember, the positions are relative, the heights are
not the same, the scroll bars will not look as if they are
scrolling in sync
g_hEditCtrl2 is the handle of the second edit control
*/
SetScrollPos(g_hEditCtrl2, SB_VERT, nScrlPos, TRUE);
/*
The link above links to the GetScrollPos and SetScrollPos
so you can get more in depth info
*/
break;
}
As for your second question, check out this: EM_SETREADONLY
Hope that helps...
-