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
IRC channel
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
Access violation with use...
by
gitPr0bit
[
Today
at 01:20:06 pm]
TDBGrid extended like Acc...
by
ttomas
[
Today
at 01:13:26 pm]
Any way to intercept stdo...
by
ccrause
[
Today
at 01:04:53 pm]
Kubuntu: No dark theme in...
by
Fungus
[
Today
at 12:58:01 pm]
CRT unit kills Ctrl-C
by
jollytall
[
Today
at 12:47:22 pm]
How can I capture all key...
by
jamie
[
Today
at 12:25:13 pm]
IInterface issues, compil...
by
jamie
[
Today
at 12:20:09 pm]
Online Package Manager
by
d.ioannidis
[
Today
at 12:16:19 pm]
help choosing laptop
by
Leledumbo
[
Today
at 12:15:41 pm]
fphttpclient. set path op...
by
Warfley
[
Today
at 11:55:46 am]
FileOpenDialog crashes/fr...
by
Martin_fr
[
Today
at 11:55:36 am]
Changes in "Search Result...
by
Martin_fr
[
Today
at 11:44:20 am]
help exporting 2 data col...
by
wp
[
Today
at 11:30:29 am]
Actions and Reslts
by
wp
[
Today
at 11:13:35 am]
Does FPC uses any interme...
by
MarkMLl
[
Today
at 10:29:28 am]
How to make a T[Flow]Pane...
by
pleumann
[
Today
at 10:19:34 am]
(Solved) Hex2Dec, strange...
by
arneolav
[
Today
at 10:02:02 am]
Making a little chart app
by
phoenix27
[
Today
at 09:50:32 am]
any one knows how to set ...
by
TRon
[
Today
at 08:54:37 am]
.cvd ClamAV database comp...
by
Onur2x
[
Today
at 03:47:26 am]
How to download a file fr...
by
maurobio
[
Today
at 02:04:49 am]
Best way to include lots ...
by
KodeZwerg
[June 04, 2023, 10:54:51 pm]
Are We Dead Yet?
by
SymbolicFrank
[June 04, 2023, 09:57:00 pm]
Working with the canvas o...
by
Jonax
[June 04, 2023, 05:31:27 pm]
ControlAtPos Behavior
by
Zoran
[June 04, 2023, 04:24:32 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] VirtualStringTree icons (Read 313 times)
Pe3s
Sr. Member
Posts: 416
[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: 677
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
Sr. Member
Posts: 416
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: 677
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
Sr. Member
Posts: 416
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