Author: Tomas Rutkauskas
Is there a way to determine if the scrollbars are present with a TListView
component? If so, is it possible to be specific enough to determine which one is
present, i.e vertical scroll or horizontal scroll?
Answer:
Yes to both:
1 {Function WindowScrollbars2 3 Parameters:4 Window handle of control or window to check.5 6 Returns:7 The TScrollstyle describing the current scrollbar configuration, either ssNone, 8 ssHorizontal, ssVertical, ssBoth.9 10 Description:11 Checks the WS_VSCROLL and WS_HSCROLL style bits of the window style.12 13 Error Conditions: none14 Created: 21.10.99 by P. Below}15 16 function WindowScrollbars(wnd: HWND): TScrollStyle;
17 var18 styleflags: DWORD;
19 begin20 styleflags := GetWindowLong(wnd, GWL_STYLE) and (WS_VSCROLL or WS_HSCROLL);
21 case styleflags of22 0: Result := ssNone;
23 WS_VSCROLL: Result := ssVertical;
24 WS_HSCROLL: Result := ssHorizontal;
25 else26 Result := ssBoth;
27 end;
28 end;
Call with listview.handle as parameter.