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
[Solved]Printing unicode ...
by
cdbc
[
Today
at 02:47:40 am]
How to set the desktop co...
by
Fibonacci
[
Today
at 02:42:15 am]
MIDI commands
by
finlazarus
[
Today
at 02:26:09 am]
FPSpreadSheet, ReadAsText...
by
andresayang
[
Today
at 02:13:18 am]
Lazarus for Windows on aa...
by
msintle
[
Today
at 01:53:20 am]
Common File Dialogs Have ...
by
msintle
[
Today
at 01:52:27 am]
Game Music Emulator
by
TRon
[
Today
at 01:23:56 am]
had a question and found ...
by
Weiss
[
Today
at 12:59:57 am]
Constants in constant exp...
by
440bx
[December 08, 2024, 11:41:59 pm]
ColorDialog can have opti...
by
Bart
[December 08, 2024, 09:14:55 pm]
Array of String lookup gi...
by
TRon
[December 08, 2024, 09:04:03 pm]
kernel 6.8 and checking s...
by
MarkMLl
[December 08, 2024, 08:12:08 pm]
AVRPascal – free code edi...
by
ackarwow
[December 08, 2024, 07:34:07 pm]
Api/component pack for Ra...
by
MarkMLl
[December 08, 2024, 07:11:01 pm]
SAVE StringGrid to PDF
by
dseligo
[December 08, 2024, 06:37:39 pm]
How to save a Graphic fro...
by
Hartmut
[December 08, 2024, 05:57:03 pm]
Array of String lookup gi...
by
Wilko500
[December 08, 2024, 05:47:16 pm]
Developing a Kernel Modul...
by
Joanna from IRC
[December 08, 2024, 04:35:26 pm]
Interesting article about...
by
cdbc
[December 08, 2024, 03:18:36 pm]
How to get hash of entire...
by
Warfley
[December 08, 2024, 01:30:18 pm]
IFS Fractals: Iterating t...
by
Dzandaa
[December 08, 2024, 11:51:08 am]
Баги CYBERGRAPHICS AmigaO...
by
Smalovsky
[December 08, 2024, 09:39:52 am]
C operators and shift
by
MarkMLl
[December 08, 2024, 09:33:12 am]
fphttpapp and Windows Ser...
by
Thaddy
[December 08, 2024, 08:36:36 am]
MIDI file generator - wor...
by
finlazarus
[December 08, 2024, 02:49:40 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: HowTo default the 1st entry as selected in a TreeView (Read 668 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: 3631
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
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)
cdbc
Hero Member
Posts: 1663
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 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0
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