Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
HowTo default the 1st entry as selected in a TreeView
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Lightweight HTML/CSS rend...
by
theo
[
Today
at 11:35:45 am]
actinon: C photorealistic...
by
Boleeman
[
Today
at 11:13:36 am]
Any way to "embed" Window...
by
d2010
[
Today
at 11:11:09 am]
Getting results from sql ...
by
Zvoni
[
Today
at 10:36:33 am]
How to remove consoleApp ...
by
d2010
[
Today
at 10:28:33 am]
Yet Another Snake Game
by
silvercoder70
[
Today
at 09:40:16 am]
Debian releases a Gtk3 La...
by
robert rozee
[
Today
at 05:10:45 am]
Initialization & finaliza...
by
runewalsh
[
Today
at 04:40:40 am]
[AGGPas] Difference betwe...
by
Graeme
[
Today
at 02:29:45 am]
[SOLVED] GTK3 : Icons hav...
by
theo
[March 16, 2026, 11:29:43 pm]
add thumb up or like butt...
by
Martin_fr
[March 16, 2026, 09:35:13 pm]
Problem with drawing orde...
by
wp
[March 16, 2026, 06:26:27 pm]
[CLARIFIED]TChart: Wrong ...
by
wp
[March 16, 2026, 06:22:26 pm]
Hello! Anything new?
by
simone
[March 16, 2026, 05:47:57 pm]
LAMW Foreground service -...
by
Mongkey
[March 16, 2026, 05:40:05 pm]
could Ardour's YTK be use...
by
Fred vS
[March 16, 2026, 04:59:52 pm]
mORMot again (HttpServer/...
by
ttomas
[March 16, 2026, 12:45:49 pm]
Is it me or is there some...
by
Martin_fr
[March 16, 2026, 11:48:04 am]
Exiting HeapTrace dump
by
jamie
[March 16, 2026, 11:34:49 am]
CONCAT formula
by
Zvoni
[March 16, 2026, 08:17:21 am]
emuloader: help to resurr...
by
arcadegamer
[March 15, 2026, 08:30:31 pm]
AutoSize TMemo.Height?
by
wp
[March 15, 2026, 05:55:05 pm]
Possible Enhancement to t...
by
jamie
[March 15, 2026, 04:10:38 pm]
lazarus 4.99 and missing ...
by
wp
[March 15, 2026, 03:11:43 pm]
Questions about TFuncSeri...
by
hedgehog
[March 15, 2026, 06:58:29 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: HowTo default the 1st entry as selected in a TreeView (Read 1182 times)
roger T
New Member
Posts: 23
HowTo default the 1st entry as selected in a TreeView
«
on:
June 25, 2024, 08:15:28 am »
Subject says most of it. When I click on an empty area of a treeview I get a SIGSEGV but do not if an item is already selected.
How do I set an entry as selected when the treeview is created
Cheers
Roger
Logged
TRon
Hero Member
Posts: 4377
Re: HowTo default the 1st entry as selected in a TreeView
«
Reply #1 on:
June 25, 2024, 08:23:37 am »
Depending on your use case you could use
selected
or
select
Logged
Today is tomorrow's yesterday.
cdbc
Hero Member
Posts: 2687
Re: HowTo default the 1st entry as selected in a TreeView
«
Reply #2 on:
June 25, 2024, 08:46:15 am »
Hi
First the easy one:
Code: Pascal
[Select]
[+]
[-]
TreeView1
.
Items
[
0
]
.
Selected
:
=
true
;
// root node selected
Second: Do you by any chance, have an 'OnClick' event-handler for the treeview? Then you need to test for nil in that handler, explicitly for when user clicks /outside/ of nodes, but generally it's good practice with treeviews.
Regards Benny
Logged
If it ain't broke, don't fix it
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release & FPC Main -> Lazarus Main
roger T
New Member
Posts: 23
Re: HowTo default the 1st entry as selected in a TreeView
«
Reply #3 on:
June 25, 2024, 08:48:06 am »
Brilliant. Thank you kindly
Cheers
Roger
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
HowTo default the 1st entry as selected in a TreeView
TinyPortal
© 2005-2018