Lazarus

Announcements => Third party => Topic started by: BeniBela on March 05, 2011, 01:54:11 am

Title: TTreeListView
Post by: BeniBela on March 05, 2011, 01:54:11 am
The TTreeListView (http://benibela.de/components_en.html#treelistview) is a combination of a TTreeView and TListView which paints a tree whose nodes can contain additional columns.
The component has (almost) all features of a tree view (like collapsing nodes, expanding, different tree lines) and of a list view (like columns, sorting, multiselection, owner drawing, alternating rows)
The visible item data is added as strings which will be managed by the ttreelistview, so you don't have to worry about memory allocation; and the view automatically supports sorting by columns and incremental searching by a search bar. However, you can also add custom data for owner drawing.
It has no external dependencies and should be able to run everywhere, no matter if you have linux/windows, gtk2/win32, 32/64-bit or Lazarus/Delphi.


Title: Re: TTreeListView
Post by: BlueIcaro on March 05, 2011, 08:44:28 am
It's nice!!. I can't wait to test it  :D

/BlueIcaro
Title: Re: TTreeListView
Post by: AmatCoder on March 05, 2011, 10:23:47 am
This is exactly what I wanted for my project.
Really this is an useful component. Good Job!

Edit: On Gtk2 it's working fine, but with QT it doesn't repaint until focus changes...Are you aware?
Minor issue anyway (and maybe it is caused by some limitation of Qt widget)
I reaffirm what I said: Really good job!

Regards.
Title: Re: TTreeListView
Post by: Hydexon on March 05, 2011, 04:24:47 pm
I'm installed TTreeListView and when put the component into the form in the IDE, shows and error: "Invalid Value: 100000" and i try to reducing that and shows me and simple treeview and runtime and exception is raised... :(
Title: Re: TTreeListView : VirtualDBTreeEx
Post by: matthius on March 05, 2011, 05:32:57 pm
Don't forget The VirtualDBTreeEx, which permits to use data rules for checking :
http://www.lazarus-components.org/remository/Components-with-sources/Visual-Components/Trees/TVirtualDBTreeEx/
Title: Re: TTreeListView
Post by: BeniBela on March 05, 2011, 05:39:45 pm
On Gtk2 it's working fine, but with QT it doesn't repaint until focus changes...Are you aware?
Not really aware, but I kind of expected it, because qt is said to not allow to bypass  the paint event.
I will fix this bug, if I ever manage to compile the qt-LCL.

I'm installed TTreeListView and when put the component into the form in the IDE, shows and error: "Invalid Value: 100000" and i try to reducing that and shows me and simple treeview and runtime and exception is raised... :(
Do you have a recent Lazarus? (~0.9.30).
I honestly never place it in the design mode, but create it during runtime, since there aren't many option to set anyways.
(but one of the reasons to make this announcement was, that it was just confirmed to work fine in design mode)
Title: Re: TTreeListView
Post by: Hydexon on March 05, 2011, 05:58:30 pm
Nop, i have the stable release (0.9.28.2 beta), and you mean if this is possible in runtime mode?
Title: Re: TTreeListView
Post by: Dibo on March 05, 2011, 07:44:03 pm
Wow, this is exactly what I needed in my project some times ago. I wrote my own similiar component for this. It has no TListView functionality. My component have only live search bar functionality (like in GNOME nautilus) similar to yours, but I am hiding non-matching nodes when writting. Can you add this "hiding" functionality (most important thing in my project)? I would like to use your component instead of my. Regards.
Title: Re: TTreeListView : VirtualDBTreeEx
Post by: JD on March 05, 2011, 08:25:16 pm
Don't forget The VirtualDBTreeEx, which permits to use data rules for checking :
http://www.lazarus-components.org/remository/Components-with-sources/Visual-Components/Trees/TVirtualDBTreeEx/

Dosen't VirtualDBTreeEx depend on VirtualTreeView? Is VirtualDBTreeEx now compatible with the latest version of VirtualTreeView because last time I tried to install VirtualDBTreeEx, it didn't work.

TTreeListView is another excellent component for Lazarus. Well done. Keep them coming....
Title: Re: TTreeListView
Post by: zeljko on March 05, 2011, 08:29:38 pm
Not really aware, but I kind of expected it, because qt is said to not allow to bypass  the paint event.
I will fix this bug, if I ever manage to compile the qt-LCL.

Qt passes paint events, but my wild guess is that you are doing some paints outside of paintevent, so it won't work on carbon too.
Title: Re: TTreeListView
Post by: zeljko on March 05, 2011, 08:53:30 pm
Yes, just tested your component, and that's it: you are using painting outside of paint event so it cannot work with qt and carbon (it works but it's ugly).
Title: Re: TTreeListView
Post by: BeniBela on March 05, 2011, 09:18:53 pm
you mean if this is possible in runtime mode?
???
I meant that you can put (e.g.) a panel as placeholder on the form and then create the treelistview like view:=ttreelistview.create(panel); view.align:=alClient;


Wow, this is exactly what I needed in my project some times ago. I wrote my own similiar component for this. It has no TListView functionality. My component have only live search bar functionality (like in GNOME nautilus) similar to yours, but I am hiding non-matching nodes when writting. Can you add this "hiding" functionality (most important thing in my project)? I would like to use your component instead of my. Regards.
I will think about it.

Qt passes paint events, but my wild guess is that you are doing some paints outside of paintevent, so it won't work on carbon too.
As I said, the treelistview bypasses the paint event.
On Windows direct drawing was always faster than waiting for paint messages
Title: Re: TTreeListView
Post by: BeniBela on March 06, 2011, 02:03:51 am
Okay, I added a workaround for qt and the drawing works there.

But it removes all optimizations; does anyone know, how to disable the background erasing with the qt interface?
Title: Re: TTreeListView
Post by: AmatCoder on March 06, 2011, 06:17:57 am
Okay, I added a workaround for qt and the drawing works there.

I'm glad to heard that. Thanks!

Quote
But it removes all optimizations;does anyone know, how to disable the background erasing with the qt interface?

Probably Zeljko knows somehow...

Regards.
Title: Re: TTreeListView
Post by: zeljko on March 06, 2011, 04:03:36 pm
Okay, I added a workaround for qt and the drawing works there.

But it removes all optimizations; does anyone know, how to disable the background erasing with the qt interface?

Qt::WA_NoSystemBackground or Qt::WA_OpaquePaintEvent attributes on TTreeListView handle (viewport) should be used in that case.

Title: Re: TTreeListView
Post by: BeniBela on March 07, 2011, 12:03:04 am
Qt::WA_NoSystemBackground or Qt::WA_OpaquePaintEvent attributes on TTreeListView handle (viewport) should be used in that case.
Thanks, now it works.
But the mouse wheel doesn't %)
Title: Re: TTreeListView
Post by: AmatCoder on March 12, 2011, 02:57:19 am
I have been testing your component with last changes and Lazarus SVN updated, and now Qt is working fine.
I wanted to thank you for the effort... Really it's appreciated. :)
Title: Re: TTreeListView
Post by: asdf on March 12, 2011, 07:50:23 am
I have downloaded on Feb 26.
Do I have to download again to get the latest one ?
Title: Re: TTreeListView
Post by: zeljko on March 12, 2011, 10:18:21 am
Qt::WA_NoSystemBackground or Qt::WA_OpaquePaintEvent attributes on TTreeListView handle (viewport) should be used in that case.
Thanks, now it works.
But the mouse wheel doesn't %)
What do you mean by "mouse wheel doesn't work" ?
What's your qt version ? What's lazarus revision ?
Title: Re: TTreeListView
Post by: BeniBela on March 12, 2011, 12:58:15 pm
Do I have to download again to get the latest one ?
Only if you want to use it with qt widgetset. (3f4040b15434 is the latest version)

What do you mean by "mouse wheel doesn't work" ?
This. (http://bugs.freepascal.org/view.php?id=18880), but you solved it already.  :D
Title: Re: TTreeListView
Post by: krexon on April 13, 2011, 04:06:57 pm
Is it possible to have characters in bold or different color in given rows or columns?
For example I have tree:
node1 --> recorditems
 --> node2 --> recordeitems
   --> node3 --> recorditems

I would like to see node1 and it's recorditems in bold and red, node2 and it's recorditems in bold and green, node3 only in black
Title: Re: TTreeListView
Post by: BeniBela on April 13, 2011, 08:07:46 pm
There is  the event OnCustomRecordItemDraw, if you set the font of sender.canvas there, the item in that row+column should be drawn with that font
Title: Re: TTreeListView
Post by: krexon on April 14, 2011, 10:04:15 am
Thanks, but how to make node1, node2 and node3 different colors. When I set sender.font.bold:=true in OnCustomRecordItemDraw, all rows are in bold. But I want ie. only rows with node1 and node2 in bold.
I have:
node1
  --> node2
    --> node3
  --> node2
node1
 -->node2
 -->node2
   -->node3
   -->node3

EDIT:
I managed to do this:
Code: [Select]
procedure TForm1.TreeListViewCustomItemDraw(sender: TObject;
  eventTyp_cdet: TCustomDrawEventTyp; item: TTreeListItem;
  var defaultDraw: Boolean);
begin
  if item.SubItems.Count>0 then TreeListView.Font.Bold:=True else TreeListView.Font.Bold:=False;
end;
Title: Re: TTreeListView
Post by: BeniBela on April 15, 2011, 01:18:14 am
I managed to do this:
So it works like you want?

Anyways it is better to use TreeListView.canvas.Font instead of  TreeListView.Font
Title: Re: TTreeListView
Post by: krexon on April 15, 2011, 09:54:35 am
But canvas.font doesn't work

Yes, it works like I wanted with one exception. It changes font of headers of columns :(
Title: Re: TTreeListView
Post by: BeniBela on April 17, 2011, 01:51:03 pm
Right, because every column can has it own font, so the font change is overwritten by the record item.
But OnCustomRecordItemDraw with canvas.font works:

Code: [Select]
procedure TExampleForm.TreeListView1CustomRecordItemDraw(sender: TObject;
 eventTyp_cdet: TCustomDrawEventTyp; recordItem: TTreeListRecordItem;
 var defaultDraw: Boolean);
begin
  if recordItem.Parent.SubItems.Count>0 then TreeListView1.Canvas.Font.Style:=[fsBold]
  else TreeListView1.Canvas.Font.Style:=[];
end;
Title: Re: TTreeListView
Post by: dalfy on June 24, 2021, 07:32:28 pm
Компонент очень хороший, спасибо. Но как присвоить ему уже созданную и настроенную поисковую панель searchBar?
Title: Re: TTreeListView
Post by: BeniBela on June 25, 2021, 11:22:21 pm
you only need to call TTreeListView.CreateSearchBar and it creates its own search bar
Title: Re: TTreeListView
Post by: dalfy on June 26, 2021, 09:35:17 am
 Спасибо.
Я так понял, что встроенных инструментов для создания combobox или DateTimePicker в столбцах нет? DateTimePicker можно создать только в TreeListView1CustomRecordItemDraw?
Title: Re: TTreeListView
Post by: mdalacu on June 26, 2021, 09:55:01 am
This component should be included in Online Package Manager.. ;)
Title: Re: TTreeListView
Post by: dalfy on June 26, 2021, 11:23:27 am
Да, я всё включил.
Как в ячейку поместить DateTimePicker?  %)
Title: Re: TTreeListView
Post by: BeniBela on July 03, 2021, 11:39:05 pm
This component should be included in Online Package Manager.. ;)

I never used the OPM

You could submit it there if  you want

Да, я всё включил.
Как в ячейку поместить DateTimePicker?  %)


There is no function for that

You could draw it in CustomRecordItemDraw or place a control on the treelistview and move it around manually
Title: Re: TTreeListView
Post by: dalfy on July 04, 2021, 11:34:44 am
Спасибо.
Title: Re: TTreeListView
Post by: PascalDragon on July 04, 2021, 12:46:31 pm
@dalfy: outside of the language specfic boards please speak English or at least provide a translation done by Google translate in addition to your native tongue.
TinyPortal © 2005-2018