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
Why isn't Lazarus / Free ...
by
PierceNg
[
Today
at 03:50:29 am]
Pdf file size is huge wit...
by
meeeeeeeeee
[
Today
at 02:56:25 am]
Help Wanted
by
dbannon
[
Today
at 02:34:37 am]
Include Informative Line ...
by
dbannon
[
Today
at 02:25:08 am]
how to compile multiple m...
by
dbannon
[
Today
at 02:11:23 am]
Lazarus Release 4.0
by
flowCRANE
[
Today
at 01:10:42 am]
FPC 3.2.2 + NASM Windows ...
by
munair
[
Today
at 12:42:00 am]
Basic Q: in TreeView one ...
by
d7_2_laz
[May 11, 2025, 11:15:39 pm]
Some links from Lazarus H...
by
Martin_fr
[May 11, 2025, 09:15:32 pm]
pigpioread - Show Raspber...
by
avra
[May 11, 2025, 09:04:36 pm]
TShape.SetTempCursor, how...
by
zeljko
[May 11, 2025, 08:34:25 pm]
RayLib 5.0
by
threedslider
[May 11, 2025, 08:19:39 pm]
randomize
by
Thaddy
[May 11, 2025, 05:26:25 pm]
LAMW arduino serial comm ...
by
Mongkey
[May 11, 2025, 05:23:58 pm]
Building Lazarus 3.4 with...
by
Fred vS
[May 11, 2025, 05:08:47 pm]
type helper not work on q...
by
PascalDragon
[May 11, 2025, 04:38:33 pm]
Maybe we should do a port...
by
PascalDragon
[May 11, 2025, 04:14:11 pm]
FPC 3.2.2 - how to fix ex...
by
PascalDragon
[May 11, 2025, 04:10:33 pm]
Library: Embed DLL in EXE
by
Thaddy
[May 11, 2025, 03:43:31 pm]
Copper Chunky Pixel
by
Gigatron
[May 11, 2025, 02:57:04 pm]
A fix causes double space...
by
dbannon
[May 11, 2025, 02:10:33 pm]
TForm's SystemButtonClick...
by
Bart
[May 11, 2025, 01:31:12 pm]
Practical Ways to Help La...
by
silvercoder70
[May 11, 2025, 11:57:00 am]
A Cross Compiler Logger
by
CM630
[May 11, 2025, 11:48:36 am]
BGRA Grid Texture Demo
by
Gigatron
[May 10, 2025, 10:53:13 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: HowTo default the 1st entry as selected in a TreeView (Read 881 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: 4351
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: 2124
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