Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] VirtualStringTree icons
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
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
What is your favorite "bu...
by
LV
[
Today
at 10:59:36 pm]
Filtering a TStringGrid. ...
by
Nicole
[
Today
at 10:52:34 pm]
Firebird 5.02. - the root...
by
rvk
[
Today
at 10:52:25 pm]
TimageList - Lazarus 4 wi...
by
Nicole
[
Today
at 10:50:14 pm]
functional IF
by
Warfley
[
Today
at 10:37:12 pm]
Destructing object whose ...
by
AlexanderK
[
Today
at 10:21:06 pm]
Compiler can't find a (fa...
by
tfurnivall
[
Today
at 09:44:46 pm]
Gateway Timeouts
by
creaothceann
[
Today
at 08:50:39 pm]
[SOLVED] macOS/Cocoa - Bl...
by
zeljko
[
Today
at 08:47:22 pm]
Linux - partly off topic...
by
Nicole
[
Today
at 08:40:34 pm]
Replace data in an existi...
by
Roni Wolf
[
Today
at 08:06:41 pm]
[Solved] Access violation...
by
Wilko500
[
Today
at 07:37:29 pm]
InstallAware 2025 Sources...
by
440bx
[
Today
at 07:16:41 pm]
Fast Canvas Library V1.0
by
Gigatron
[
Today
at 06:44:27 pm]
Testers required for LAMW...
by
RayoGlauco
[
Today
at 06:28:40 pm]
FPC 3.2.2 - checksum Erro...
by
paule32
[
Today
at 06:06:55 pm]
Output buffer to audio.
by
Fred vS
[
Today
at 06:00:36 pm]
TProcess freeze
by
LemonParty
[
Today
at 05:47:18 pm]
StringGrid - How to force...
by
etrusco
[
Today
at 05:38:11 pm]
[SOLVED] Speeding up the ...
by
etrusco
[
Today
at 05:28:25 pm]
Layout problem by nested ...
by
Nicole
[
Today
at 05:08:47 pm]
"LCLVersion" in *.lfm fil...
by
zeljko
[
Today
at 04:54:27 pm]
Concole model programming
by
TBMan
[
Today
at 03:50:18 pm]
how to break out early of...
by
creaothceann
[
Today
at 02:39:09 pm]
I couldn't take the white...
by
creaothceann
[
Today
at 12:55:14 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] VirtualStringTree icons (Read 643 times)
Pe3s
Hero Member
Posts: 596
[SOLVED] VirtualStringTree icons
«
on:
March 04, 2023, 06:33:26 pm »
Hello forum users, I wrote a code that displays icons in VST. How can I modify the code to add a different icon to the child?
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
VSTGetImageIndex
(
Sender
:
TBaseVirtualTree
;
Node
:
PVirtualNode
;
Kind
:
TVTImageKind
;
Column
:
TColumnIndex
;
var
Ghosted
:
Boolean
;
var
ImageIndex
:
Integer
)
;
begin
case
Kind
of
ikNormal
,
ikSelected
:
case
Column
of
0
:
ImageIndex
:
=
0
;
end
;
end
;
end
;
«
Last Edit: March 04, 2023, 08:16:57 pm by Pe3s
»
Logged
paweld
Hero Member
Posts: 1418
Re: VirtualStringTree icons
«
Reply #1 on:
March 04, 2023, 06:56:50 pm »
something like this:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
VSTGetImageIndex
(
Sender
:
TBaseVirtualTree
;
Node
:
PVirtualNode
;
Kind
:
TVTImageKind
;
Column
:
TColumnIndex
;
var
Ghosted
:
Boolean
;
var
ImageIndex
:
Integer
)
;
var
nl
:
Integer
;
begin
nl
:
=
Sender
.
GetNodeLevel
(
Node
)
;
case
nl
of
0
:
ImageIndex
:
=
0
;
//root
1
..
3
:
ImageIndex
:
=
1
;
//child level between 1 and 3
4
..
6
:
ImageIndex
:
=
2
;
//etc.
end
;
end
;
Logged
Best regards / Pozdrawiam
paweld
Pe3s
Hero Member
Posts: 596
Re: VirtualStringTree icons
«
Reply #2 on:
March 04, 2023, 07:14:21 pm »
Everything would be ok if there were no duplicate icons
Logged
paweld
Hero Member
Posts: 1418
Re: VirtualStringTree icons
«
Reply #3 on:
March 04, 2023, 07:23:31 pm »
You need to add a column condition
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
VSTGetImageIndex
(
Sender
:
TBaseVirtualTree
;
Node
:
PVirtualNode
;
Kind
:
TVTImageKind
;
Column
:
TColumnIndex
;
var
Ghosted
:
Boolean
;
var
ImageIndex
:
Integer
)
;
var
nl
:
Integer
;
begin
if
Column
=
0
then
begin
nl
:
=
Sender
.
GetNodeLevel
(
Node
)
;
case
nl
of
0
:
ImageIndex
:
=
0
;
//root
1
..
3
:
ImageIndex
:
=
1
;
//child level between 1 and 3
4
..
6
:
ImageIndex
:
=
2
;
//etc.
end
;
end
;
end
;
Logged
Best regards / Pozdrawiam
paweld
Pe3s
Hero Member
Posts: 596
Re: VirtualStringTree icons
«
Reply #4 on:
March 04, 2023, 08:16:40 pm »
@paweld Thank you
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
[SOLVED] VirtualStringTree icons
TinyPortal
© 2005-2018