Is there a quick way to add the Horizontal Scroll bar to the TreeView? I need this for my new file/directory Treeview component I’m doing. Which I will make it open-source once its done. 8)
Wk
Is there a quick way to add the Horizontal Scroll bar to the TreeView? I need this for my new file/directory Treeview component I’m doing. Which I will make it open-source once its done. 8)
Wk
It appears automatically if any of your items are too wide to fit.
Got it, I have to check now how I’m adding the itens to the list, as I just took your code for the FileTreeComponent component, and I’m doing my own.
Wk
Got it, I need to implement:
Now, I will check if I could do this in a way that is not fixed, but it takes the current directory/filename lenght in account.
Wk
Its working, but I need to determinate a fixed size.
Now, is there a way to know how much space it would take a text to be drawn? That way I could tell each item its correct size.
Wk
Font::getStringWidth
:oops:
I looked everywhere.
Thanks Jules, as always.
Wk
That did the trick. :mrgreen:
[code] virtual int getItemWidth() const
{
String fFile;
if (owner.showExtensions) { if (file == file.getLinkedTarget()) fFile = file.getFileName(); else fFile = file.getFileNameWithoutExtension(); }
else { if (file == file.getLinkedTarget()) fFile = file.getFileNameWithoutExtension(); else fFile = File(file.getFileNameWithoutExtension()).getFileNameWithoutExtension(); }
return Font(getItemHeight() * 0.7f).getStringWidth(fFile) + treeImageWidth;
}[/code]