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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Boolean type
by
Martin_fr
[
Today
at 11:15:20 am]
How to DIY a filerec reco...
by
TYDQ
[
Today
at 10:58:11 am]
ToDoList package, support...
by
cdbc
[
Today
at 09:24:35 am]
Error: Illegal parameter:...
by
daniel_sap
[
Today
at 06:45:47 am]
[SOLVED] WebP images and ...
by
TRon
[
Today
at 05:25:05 am]
Times Tables Curves: Some...
by
Boleeman
[
Today
at 04:45:52 am]
accessing array members i...
by
TRon
[
Today
at 01:01:35 am]
RGB Plasma
by
Gigatron
[April 20, 2025, 11:26:28 pm]
Testing with SQLite3DataS...
by
cdbc
[April 20, 2025, 09:27:04 pm]
Using a custom record as ...
by
ilowry
[April 20, 2025, 08:12:10 pm]
Lectura puerto serie
by
Edson
[April 20, 2025, 07:42:47 pm]
Compile Error on Assign f...
by
marcov
[April 20, 2025, 03:10:08 pm]
Knob Finger Spinner Graph...
by
circular
[April 20, 2025, 01:40:05 pm]
[solved] looping directio...
by
cdbc
[April 20, 2025, 01:20:04 pm]
Managing linked list as i...
by
cdbc
[April 20, 2025, 01:17:44 pm]
lcl-pdf is not UTF8?
by
marcov
[April 20, 2025, 01:15:19 pm]
A very simple and basic q...
by
marcov
[April 20, 2025, 01:13:18 pm]
New version of LazMapView...
by
Dzandaa
[April 20, 2025, 12:55:49 pm]
Forum slow for others as ...
by
PascalDragon
[April 20, 2025, 11:58:48 am]
Avaiable instruction set
by
LemonParty
[April 20, 2025, 09:26:31 am]
Amigo programming languag...
by
paxscript
[April 20, 2025, 07:56:57 am]
2d "platform" game sugges...
by
Roland57
[April 20, 2025, 07:52:39 am]
This is me back in Lazaru...
by
Weiss
[April 20, 2025, 06:34:41 am]
GTK3 still alpha
by
regs
[April 20, 2025, 01:46:35 am]
ppaslink.sh: line 9: 6262...
by
Thaddy
[April 19, 2025, 07:58:29 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: HowTo default the 1st entry as selected in a TreeView (Read 873 times)
roger T
New Member
Posts: 14
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: 4288
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: 2083
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 -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99
roger T
New Member
Posts: 14
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