Hi
I have and dialog and child window in it.
In this child window i have button as a child window.
When user scrool in dialog. I get a message and try to scroll child window by ScrollWindow. All works button moves. But when i stop scrolling,button return to it's start place(i.e when i scrolling button go to the edge of window,but when i up mouse button,button returns to its start place).Why?
Code:CDialog: childWindow.Create(NULL,NULL,WS_HSCROLL|WS_CHILD|WS_VISIBLE,Rect,this,0); SCROLLINFO scrollInfo; memset((void*)&scrollInfo,0,sizeof(scrollInfo)); scrollInfo.cbSize = sizeof(scrollInfo); scrollInfo.fMask = SIF_ALL; if(GetScrollInfo(SB_HORZ ,&scrollInfo,SIF_ALL)) { childWindow.SetScrollInfo(SB_HORZ,&scrollInfo,TRUE); childWindow.ShowScrollBar(SB_HORZ,FALSE);//use not own scrollbar } void OnScrool(WPARAM wParam,LPARAM lParam) { int step = 100; childWindow.SetScrollPos(SB_HORZ,pos,TRUE); childWindow.ScrollWindow(-step,0,NULL,NULL); childWindow.UpdateWindow(); } CChildWindow: CButton btn; btn.Create("OK",WS_CHILD|WS_VISIBLE,CRect(0,0,100,20),this,0);




Reply With Quote