I am using the ListBox and find that although I have side borders, the bottom border is missing. If Header.Visible = False, the top border is also missing.
Is there a setting that might be wrong ? Is it related to the relationship between item height and the listbox height ?
Any pointers will be appreciated.
Under which circumstances do you experience this? dropping a default listbox on the form does not reproduce this issue.
The issue is related to styles. For some styles, the border around the listbox is not drawn correctly in line with the new style. When this happens, the bottom border is drawn correctly under the scroll bar only, when there is a vertical scroll bar. If there is no scroll bar, the listbox looks like it has 3 borders. In further testing I couldn't reproduce the top border being displayed without the style being applied. Styles bite us again.
In order to get around this, I tried using the TreeView, which does draw its borders correctly when the style changes. I have been able to almost reproduce the effect I am after. I am displaying a list of items, and do not want the tree lines to show. This is why I selected the listbox. I have been able to hide the tree lines in the treeview, but I haven't yet worked out how to align the text to the left of the display area. The place where the tree lines are normally displayed is blank, and I would prefer the text move to the left to take this space.
Is there a way to do this ?
I set LevelIndent = 0, but this didn't help.
Currently I am only using 1 column and manually indenting the second level data, as that is what I was doing in the listbox. If it is possible to drop the indenting for the tree lines for a single column treeview, that would work for me. Or even the combination of ShowLines = False and LevelIndent = 0
The TTMSFNCListBox is a TTMSFNCTreeView in disguise. You can use the following properties to turn a TTMSFNCTreeView in a TTMSFNCListBox:
FTreeView.NodesAppearance.ExpandColumn := -1;
FTreeView.NodesAppearance.LevelIndent := 0;
FTreeView.NodesAppearance.ShowLines := False;
FTreeView.NodesAppearance.ExpandWidth := 0;
FTreeView.NodesAppearance.ExpandHeight := 0;
FTreeView.NodesAppearance.SelectionArea := tsaFull;
This work perfectly.
TTMSFNCTreeview is a very powerful component once you learn how to how to use it.