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
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
Is there a Lazbuild compi...
by
dbannon
[
Today
at 03:23:33 am]
Cirumvent the assignment ...
by
dbannon
[
Today
at 03:09:01 am]
Setting up an ARM embedde...
by
Ruptor
[
Today
at 12:44:58 am]
Tedit control that adjust...
by
simsee
[
Today
at 12:36:13 am]
Compare two text lines an...
by
simone
[
Today
at 12:04:05 am]
ChatGPT and ObjectPascal ...
by
Joanna
[July 12, 2025, 08:02:23 pm]
About Skia graphics engin...
by
aydın
[July 12, 2025, 07:58:51 pm]
problem by export and imp...
by
paule32
[July 12, 2025, 07:43:53 pm]
Searching for current wor...
by
Thaddy
[July 12, 2025, 07:22:28 pm]
Has anyone installed TeeB...
by
Thaddy
[July 12, 2025, 07:06:19 pm]
new private messages fly ...
by
Martin_fr
[July 12, 2025, 05:13:47 pm]
Fpcupdeluxe
by
DonAlfredo
[July 12, 2025, 04:45:54 pm]
[SOLVED] SQLite query to ...
by
DanishMale
[July 12, 2025, 04:37:24 pm]
Pulsating Radial Segments...
by
Boleeman
[July 12, 2025, 04:11:52 pm]
Object Pascal Playing Car...
by
marcov
[July 12, 2025, 02:53:25 pm]
Fast Canvas Library V1.05...
by
Gigatron
[July 12, 2025, 02:49:43 pm]
Trouchet Koch (Snowflake ...
by
Boleeman
[July 12, 2025, 02:34:31 pm]
Extended Module Player
by
Gigatron
[July 12, 2025, 02:27:09 pm]
controls.lpr(731,15) Erro...
by
Martin_fr
[July 12, 2025, 11:44:05 am]
Amigo programming languag...
by
paxscript
[July 12, 2025, 08:48:11 am]
[Solved]Garbled web page ...
by
PeterHu
[July 12, 2025, 08:34:38 am]
Rainbowed Rotating Square...
by
Boleeman
[July 12, 2025, 07:33:00 am]
[Solved]Retrieving wrong ...
by
PeterHu
[July 12, 2025, 03:19:47 am]
I read this somewhere... ...
by
1HuntnMan
[July 12, 2025, 12:06:28 am]
TCustomApplication.DoRun
by
cdbc
[July 11, 2025, 09:31:55 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: HowTo default the 1st entry as selected in a TreeView (Read 952 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: 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: 2253
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