VertScrollBar.Visible always returns TRUE

I have a custom control derived from TScrollBox. At run time, I need to know weather the vertical scrollbar is visible or not. If I interrogate the Visible property it always returns true, no matter if the scrollbar is visible or not!

function TMyScrollPanel.ScrollVisible: boolean;
 Result:=  Self.VertScrollBar.Visible;            <----------- always true

However, this works correctly:

function VertScrollBarVisible(WindowHandle: THandle): Boolean;                  
 Result:= (GetWindowlong(WindowHandle, GWL_STYLE) AND WS_VSCROLL) <> 0

What is wrong with the first function?


Reading a scrollbar Visible property only retrives VCL control state. The property won't retrieve the current state from the actual scrollbar window. Use the IsScrollBarVisible property instead.

Use the IsScrollBarVisible method instead, to check whether a scrollbar is visible because the scrollable window can be scrolled.

Reading the Visible property only retrieves the cached value of its visibility setting (can be visible or not). For a scrollable window, the property won't retrieve the current state from the actual window.

Need Your Help

How to lie two canvas at one Tab Navigator?

flex canvas tabnavigator

I want to lie two canvas at one Tab Navigator. when I use

Mapping Enums in template specializations

c++ templates enums template-specialization

I have a templated class which uses a global enum with some modes I need as parameters for the member functions of that class. I want to write a specialization of that class which requires that the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.