Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

TTreeview fires lots and lots of events

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

The TTreeview seems to fire a lot of events which doesn't seem right. Attached are two images showing what I did.

treeview_form_gets_focus.png
Here the form containing the treeview simply got focus. Note all the events that fired - as shown in the debug server.

treeview_select_node_changed.png
Here I simply selected a different tree node. Again, note all the events that fired due to that action - all events inside the red rectangle.

Is this normal?

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net -------------- next part -------------- A non-text attachment was scrubbed... Name: treeview_form_gets_focus.png Type: image/png Size: 12406 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111025/bb5dd876/attachment-0002.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: treeview_select_node_changed.png Type: image/png Size: 13528 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111025/bb5dd876/attachment-0003.png>

Reply by email

zeljko
to Graeme Geldenhuys
Graeme Geldenhuys wrote 8 lines
Hi, The TTreeview seems to fire a lot of events which doesn't seem right. Attached are two images showing what I did. treeview_form_gets_focus.png Here the form containing the treeview simply got focus. Note all the events that fired - as shown in the debug server.

As mentioned below, OnGetImageIndex is probably triggered from paint method, it triggers per item (because each item can have different image or no image at all).

treeview_select_node_changed.png Here I simply selected a different tree node. Again, note all the events that fired due to that action - all events inside the red rectangle.

This one seem ok. Selection is changed, OnGetImageIndex is probably called from paint method.

Is this normal?

Looks good

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111025/42a2b0b4/attachment.html>

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: The TTreeview seems to fire a lot of events which doesn't seem right. Attached are two…
Show quoted text 14 lines
Hi, The TTreeview seems to fire a lot of events which doesn't seem right. Attached are two images showing what I did. treeview_form_gets_focus.png Here the form containing the treeview simply got focus. Note all the events that fired - as shown in the debug server. treeview_select_node_changed.png Here I simply selected a different tree node. Again, note all the events that fired due to that action - all events inside the red rectangle. Is this normal?

Yes.
The selection triggers a paint, which paints every visible node, which triggers one OnGetImageIndex for each node.

Mattias

Reply by email

Graeme Geldenhuys
to zeljko: As mentioned below, OnGetImageIndex is probably triggered from paint method, it triggers…
zeljko wrote 9 lines
> treeview_form_gets_focus.png > Here the form containing the treeview simply got focus. Note all the > events that fired - as shown in the debug server. As mentioned below, OnGetImageIndex is probably triggered from paint method, it triggers per item (because each item can have different image or no image at all).

OK, I can probably take that as an answer, because the unfocused Window (or Treeview) paints the selected node differently. But why the odd number of events? The treeview only has 6 nodes, but there was 10 events fired.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email