Recent

Author Topic: TTreeListView  (Read 26156 times)

BeniBela

  • Hero Member
  • *****
  • Posts: 755
    • homepage
Re: TTreeListView
« Reply #15 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 %)

AmatCoder

  • New Member
  • *
  • Posts: 36
    • My site
Re: TTreeListView
« Reply #16 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. :)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Re: TTreeListView
« Reply #17 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 ?
Lazarus 1.2.4 / Win 32 / THAILAND

zeljko

  • Hero Member
  • *****
  • Posts: 1147
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: TTreeListView
« Reply #18 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 ?

BeniBela

  • Hero Member
  • *****
  • Posts: 755
    • homepage
Re: TTreeListView
« Reply #19 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., but you solved it already.  :D

krexon

  • Jr. Member
  • **
  • Posts: 72
Re: TTreeListView
« Reply #20 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

BeniBela

  • Hero Member
  • *****
  • Posts: 755
    • homepage
Re: TTreeListView
« Reply #21 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

krexon

  • Jr. Member
  • **
  • Posts: 72
Re: TTreeListView
« Reply #22 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;
« Last Edit: April 14, 2011, 10:21:22 am by krexon »

BeniBela

  • Hero Member
  • *****
  • Posts: 755
    • homepage
Re: TTreeListView
« Reply #23 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

krexon

  • Jr. Member
  • **
  • Posts: 72
Re: TTreeListView
« Reply #24 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 :(

BeniBela

  • Hero Member
  • *****
  • Posts: 755
    • homepage
Re: TTreeListView
« Reply #25 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;

 

TinyPortal © 2005-2018