Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
GTK2 widget Listview can not show items when set OwnerData to False from True
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
Recent
lazbuild vs IDE: PPU chec...
by
dmitryb
[
Today
at 06:30:43 am]
I have made some progress...
by
egsuh
[
Today
at 05:36:50 am]
Install new .deb over exi...
by
dbannon
[
Today
at 03:42:52 am]
equivalent to C/C++ "offs...
by
Fibonacci
[
Today
at 03:40:37 am]
Lazarus Main not building...
by
dbannon
[
Today
at 03:01:32 am]
Lazarus interface to Rexx...
by
mdlueck
[July 13, 2026, 09:52:18 pm]
LazSWatch - a serial port...
by
CM630
[July 13, 2026, 08:17:10 pm]
WASM import error
by
lebao3105
[July 13, 2026, 05:51:47 pm]
OpenDocument('Filename') ...
by
J-G
[July 13, 2026, 05:23:26 pm]
Lazarus Bugfix Release 4....
by
n7800
[July 13, 2026, 04:56:57 pm]
Discipline your AI coding...
by
Weiss
[July 13, 2026, 04:37:42 pm]
Hello. I'm new to this co...
by
zeljko
[July 13, 2026, 02:17:38 pm]
TCollection wiki entry
by
Thaddy
[July 13, 2026, 01:24:21 pm]
weird error message
by
cdbc
[July 13, 2026, 12:23:13 pm]
Freepascal
by
LeP
[July 13, 2026, 09:40:33 am]
TTL Record Count, i.e. a ...
by
Zvoni
[July 13, 2026, 09:10:08 am]
Printing on HP Smart Tank
by
Thaddy
[July 13, 2026, 07:10:37 am]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[July 13, 2026, 06:38:27 am]
MVP made easier.
by
cdbc
[July 13, 2026, 06:18:24 am]
Lazarus 4.6 may erase you...
by
Martin_fr
[July 12, 2026, 06:35:29 pm]
Best name for procedure
by
LemonParty
[July 12, 2026, 05:23:02 pm]
Fixed an RV32ec compiler ...
by
MattBradford
[July 12, 2026, 05:11:16 pm]
Many recent books on Laza...
by
Tomu
[July 12, 2026, 05:02:44 pm]
International Pascal Cong...
by
zeljko
[July 12, 2026, 04:08:53 pm]
val return code
by
ALLIGATOR
[July 12, 2026, 01:40:21 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: GTK2 widget Listview can not show items when set OwnerData to False from True (Read 178 times)
cai
New Member
Posts: 46
GTK2 widget Listview can not show items when set OwnerData to False from True
«
on:
May 24, 2026, 05:39:04 pm »
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
begin
ListView1
.
OwnerData
:
=
True
;
ListView1
.
Items
.
Count
:
=
100
;
end
;
procedure
TForm1
.
Button2Click
(
Sender
:
TObject
)
;
var
I
:
Integer
;
begin
if
ListView1
.
OwnerData
then
ListView1
.
Items
.
Count
:
=
0
else
ListView1
.
Items
.
Clear
;
ListView1
.
OwnerData
:
=
False
;
for
I
:
=
0
to
10
-
1
do
begin
with
ListView1
.
Items
.
Add
do
begin
Caption
:
=
IntToStr
(
I
)
;
SubItems
.
Add
(
'test1'
)
;
end
;
end
;
end
;
procedure
TForm1
.
ListView1Data
(
Sender
:
TObject
;
Item
:
TListItem
)
;
begin
Item
.
Caption
:
=
IntToStr
(
Item
.
Index
)
;
Item
.
SubItems
.
Add
(
'test2'
)
;
end
;
click Button1 ---> click Button2, no item show in listview
”
ListView1.OwnerData:=False;
“ seems like not work in GTK2 widget,
should I recreate listview?
Logged
cai
New Member
Posts: 46
Re: GTK2 widget Listview can not show items when set OwnerData to False from True
«
Reply #1 on:
May 24, 2026, 05:53:47 pm »
fixed code!
Code: Pascal
[Select]
[+]
[-]
type
TListItemsPatch
=
class
(
TListItems
)
end
;
procedure
TForm1
.
Button2Click
(
Sender
:
TObject
)
;
begin
...
....
ListView1
.
OwnerData
:
=
False
;
[
b
]
TListItemsPatch
(
ListView1
.
Items
)
.
WSCreateItems
;
[
/
b
]
...
...
end
;
call WSCreateItems and it work now. not test carefully, just for demo
Logged
zeljko
Hero Member
Posts: 1982
Re: GTK2 widget Listview can not show items when set OwnerData to False from True
«
Reply #2 on:
May 25, 2026, 10:15:53 am »
Even on gtk3,qt5,qt6 changing ownerDraw does nothing in WS code.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
GTK2 widget Listview can not show items when set OwnerData to False from True
TinyPortal
© 2005-2018