* * *

Author Topic: [SOLVED] A TTreeView problem that should be easy to fix.  (Read 191 times)

EganSolo

  • Full Member
  • ***
  • Posts: 120
[SOLVED] A TTreeView problem that should be easy to fix.
« on: August 29, 2017, 03:56:12 am »
I'm using a TTreeView to display files in a folder. Nothing too crazy.
The first image shows one entry in that TTreeView with a glyph and a text.
If I click on it, TTreeView goes immediately into edit mode and the associated glyph vanishes. I've pressed enter and escape and nothing happens.

This should be easy to fix, right?

« Last Edit: August 29, 2017, 06:08:28 am by EganSolo »

EganSolo

  • Full Member
  • ***
  • Posts: 120
Re: [SOLVED] A TTreeView problem that should be easy to fix.
« Reply #1 on: August 29, 2017, 06:08:13 am »
The solution was indeed easy.
If you do not set TTreeNode.SelectedIndex to the index of the glyph that you want, then TTreeView assumes you do not want a glyph in selected mode. That actually make sense if, say the actual glyph depends on the text that you type.

All in all, it was a very easy fix.

Hope this helps other.
Also, be sure to check the site that is referenced in the TTreeView Example folder that ships with Lazarus.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus