I guess this is a weird question, I hope you can understand what i mean (ill try my best to explain, writting in English is very hard for me).
My program has a "STATUS" window which outputs what my program is doing inside a LISTBOX control. This LISTBOX is updated with new lines of info several times each minute. So I have created a "Auto Scroll" checkbox in this window. When this chekbox is checked, the Vertical Scrollbar autoscrolls to the end of the text every time new text is inserted. This is working (finally, thank god!).
Now what i need to do is the following: If the user clicks on the UP arrow in the scrollbar, i would like this checkbox to get unchecked, so that the user can read the previous messages.
Ive done a lot of searching and i just couldnt find what message am i searching for in other to intercept it.
So, what message is generated when the UP arrow of a Scrollbar into a LISTBOX control is pressed?
Dont know if that makes any difference, but the scrollbar is not a separated ScrollBar control, it is a WS_VSCROLL style added to the ListBox control.
Hope you could understand what i mean, any help would be great.
/LostNewbie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First I think you will need to subclass the listbox so you can intercept its messages. Not sure, but pretty sure ;). Then intercept the WM_VSCROLL message. Here is what I pulled off of the win32 reference from vUpdate:
The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
WM_VSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle of scroll bar
Parameters
nScrollCode
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:
Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
SB_LINEDOWN Scrolls one line down.
SB_LINEUP Scrolls one line up.
SB_PAGEDOWN Scrolls one page down.
SB_PAGEUP Scrolls one page up.
SB_THUMBPOSITION Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.
nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.
hwndScrollBar
Value of lParam. Identifies the control if WM_VSCROLL is sent by a scroll bar control. If WM_VSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.
Return Values
If an application processes this message, it should return zero.
Hope that helps =)
Kip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tried that a lot, but as I could understand that does not work if the ScrollBar is a style added to a Control. It will only work for a control created with the ScrollBar Class.
Does anyone have any other idea?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess this is a weird question, I hope you can understand what i mean (ill try my best to explain, writting in English is very hard for me).
My program has a "STATUS" window which outputs what my program is doing inside a LISTBOX control. This LISTBOX is updated with new lines of info several times each minute. So I have created a "Auto Scroll" checkbox in this window. When this chekbox is checked, the Vertical Scrollbar autoscrolls to the end of the text every time new text is inserted. This is working (finally, thank god!).
Now what i need to do is the following: If the user clicks on the UP arrow in the scrollbar, i would like this checkbox to get unchecked, so that the user can read the previous messages.
Ive done a lot of searching and i just couldnt find what message am i searching for in other to intercept it.
So, what message is generated when the UP arrow of a Scrollbar into a LISTBOX control is pressed?
Dont know if that makes any difference, but the scrollbar is not a separated ScrollBar control, it is a WS_VSCROLL style added to the ListBox control.
Hope you could understand what i mean, any help would be great.
/LostNewbie
Hey man,
First I think you will need to subclass the listbox so you can intercept its messages. Not sure, but pretty sure ;). Then intercept the WM_VSCROLL message. Here is what I pulled off of the win32 reference from vUpdate:
The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
WM_VSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle of scroll bar
Parameters
nScrollCode
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:
Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
SB_LINEDOWN Scrolls one line down.
SB_LINEUP Scrolls one line up.
SB_PAGEDOWN Scrolls one page down.
SB_PAGEUP Scrolls one page up.
SB_THUMBPOSITION Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.
nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.
hwndScrollBar
Value of lParam. Identifies the control if WM_VSCROLL is sent by a scroll bar control. If WM_VSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.
Return Values
If an application processes this message, it should return zero.
Hope that helps =)
Kip
Tried that a lot, but as I could understand that does not work if the ScrollBar is a style added to a Control. It will only work for a control created with the ScrollBar Class.
Does anyone have any other idea?