Search code examples
delphilistboxfiremonkeydelphi-xe5

Delphi. Firemonkey. TListbox. Is scrollbar visible?


I want resize my form height by ListBox items count - increase height while scrollbar visible. How to know, is scrollbar visible or nor in TListbox? So, there are a tons of information for VCL (based on Handle) but not for FMX. Lazy method:

ListBox1.Items.Count * Round(ListBox1.ItemByIndex(0).Height)

This method not working properly because form border and caption can be different on different machines.


Solution

  • To adjust form's height or width to accommodate some content you should use ClientWidth and ClientHeight properties of the form rather that Width and Height

    ClientWidth and ClientHeight hold dimension of form without border, caption and menu area.