virtualtreeview

Auto sizing column in TVirtualStringTree

时间秒杀一切 提交于 2019-12-07 03:14:46
问题 Climbing the learning mountain of TVirtualTreeView, I'm attempting to create a custom descendant that ensures that, when the control is resized, the width of the last column exactly fills control's width without requiring a horizontal scroll bar. I see a number of items (a method and a number of events) pertaining to "AutoFitColumns", but not documentation covering this feature. Can I use AutoFitColumns to automatically resize my last column and if so, how. 回答1: With your virtualtreeview, and

How to set the color of VirtualStringTree header?

拜拜、爱过 提交于 2019-12-06 17:41:43
问题 The VirtualStringTree header has a 'Background' property but setting it to a different color does not change the color. I suspect the tree is rendered using Windows themes. How can I set the color? 回答1: You can use property THeader.Background but you'll have to exclude toThemeAware from TreeOptions.PaintOptions . That would turn off themes, as TLama already said in his comment above. I recommend you to use the events OnAdvancedHeaderDraw and OnHeaderDrawQueryElements . hoOwnerDraw has to be

How can I keep the check state of multiple Virtual Tree View nodes in sync?

两盒软妹~` 提交于 2019-12-06 11:36:05
My tree has 2 levels of nodes - it's a Contact List style tree. My problem is, that I would like to have every contact checked, in all the "Contact Categories". Here is a screenshot of my contact list as it looks now (And yes, I have permission to post it) As you see, Todd Hirsch is checked in the Category Test Category , but not in All Contacts . What I am trying to achieve, is to have a contact have the same checked status in every category. Example: I check Todd Hirsch in the Test Category - Todd Hirsch is automatically checked in All Contacts (And every other category). If I check Todd

VirtualTreeView add roots with Threads

◇◆丶佛笑我妖孽 提交于 2019-12-06 07:53:21
I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like this: function AddRoot ( p : TForm1 ) : Integer; stdcall; begin p.VirtualStringTree1.AddChild(NIL); end; var Dummy : DWORD; i : Integer; begin for i := 0 to 2000 do begin CloseHandle(CreateThread(NIL,0, @ADDROOT, Self,0, Dummy)); end; end; The reason for this is that I want to add all connections from my INDY Server to the TreeView. Indy's onexecute/onconnect get's called as a thread. So if 3+ connections come in at the same time the app crashes due to the TreeView.

How best to render an overlay icon on top of basic Delphi TVirtualTreeView node icon

情到浓时终转凉″ 提交于 2019-12-06 04:53:09
问题 I'm converting a tree view from the standard TTreeView to use TVirtualStringTree. My final challenge is to implement a feature where I need to draw a 'pass/fail' status indicator on top of the known node icon. With TTreeView I used: var R : TRect; begin R := Node.DisplayRect( True ); StatusIconList.Draw( TreeView1.Canvas, R.Left - StatusIconList.Width - 14, R.Top, 3 {MyOverlayImageIndex} ); The result is the red cross over the basic icon as shown below: With TVirtualStringTree I hoped to find

Is it possible to select multiple columns in Virtual Treeview?

自闭症网瘾萝莉.ら 提交于 2019-12-06 00:40:38
问题 I need to add functionality to copy a rectangular selection of nodes and columns, but I can't find any way to actually select multiple columns in a Virtual Treeview (beside toFullRowSelect). Am I just missing something? And if not, is there a descendant out there with grid-like multicolumn select support? 回答1: So after some testing I came up with the following, thanks DiGi for the extra push. DrawSelection won't work with this solution so it needs to be disabled. Since I don't think I'll need

Color VirtualStringTree rows with hidden nodes

三世轮回 提交于 2019-12-05 18:19:11
I'm currently using this code in the OnBeforeCellPaint event of my tree: if Node.Index mod 2 = 0 then begin TargetCanvas.Brush.Color := clBlack; TargetCanvas.FillRect(CellRect); end else begin TargetCanvas.Brush.Color := clPurple; TargetCanvas.FillRect(CellRect); end; To color my nodes. But with hidden nodes this doesn't work as the index stays the same. Is there an visible index or an easy workaround? Thanks in advance. There is no such method to get visibility node index at this time. But you can make your own where you will iterate through the visible nodes and count each iteration.

VirtualStringTree Correct/recommended use

与世无争的帅哥 提交于 2019-12-05 01:05:38
问题 I have been using virtualstringtree for a while now. I use it for two different things, first a s a normal tree for selecting ,displaying data and secondly as a grid to show outputs from SQL statements. All my data loaded in to the trees is from a database. For the tree example, i have a parentId field to distinguish the heirarchy, and for the grid examples i simply use an SQL statement with a customized record for each tree (that is unique). My questions relates to the preferred/best way to

How to set the color of VirtualStringTree header?

别说谁变了你拦得住时间么 提交于 2019-12-04 21:09:40
The VirtualStringTree header has a 'Background' property but setting it to a different color does not change the color. I suspect the tree is rendered using Windows themes. How can I set the color? You can use property THeader.Background but you'll have to exclude toThemeAware from TreeOptions.PaintOptions . That would turn off themes, as TLama already said in his comment above. I recommend you to use the events OnAdvancedHeaderDraw and OnHeaderDrawQueryElements . hoOwnerDraw has to be included in Header.Options for them to take effect. In OnHeaderDrawQueryElements you set Elements to (at

Is it safe to access VT data from the other thread?

允我心安 提交于 2019-12-04 11:06:01
Is it safe to change VirtualTreeView data from the secondary thread ? And if yes, should I use critical sections (or even Synchronize method) ? I'm afraid that when I'll be writing to the VT's data record from the other thread, main thread invokes its repaint meanwhile and this refresh will cause reading of the same record at one time. I would supplement I'm using only 2 threads in the application. Something like ... type PSomeRecord = ^TSomeRecord; TSomeRecord = record SomeString: string; SomeInteger: integer; SomeBoolean: boolean; end; ... var FCriticalSection: TRTLCriticalSection; // global