Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#5: Can I display a node in standard TTreeView component with bold style without custom drawing?

Time-to-time I receive the question how I realized a selection by the bold font for some nodes in the SMReport Explorer form.

Today I have decided to describe this very simple way (but very useful). It does not require an override of any custom drawing methods/events, creating
a new component etc. It's a real standard way.
**********************************************************
The standard Windows Treeview control have a few state flags (TVIS_BOLD and TVIS_CUT in our example), due to which it's possible to reach wished.

At first, let's write the procedure SetNodeState:

procedure SetNodeState(node: TTreeNode; Flags: Integer);
var tvi: TTVItem;
begin
  FillChar(tvi, SizeOf(tvi), 0);
  tvi.hItem := node.ItemID;
  tvi.Mask := TVIF_STATE;
  tvi.StateMask := TVIS_BOLD or TVIS_CUT;
  tvi.State := Flags;
  TreeView_SetItem(node.Handle, tvi);
end;

And now we can set a wished flags:
SetNodeState(node, TVIS_BOLD) - to set the node as Bold
SetNodeState(node, TVIS_CUT) - to set the node as Cutted
SetNodeState(node, TVIS_BOLD or TVIS_CUT) - to set the node as Bold and
Cutted
SetNodeState(node, 0) - to set a node as normal
*******************************************

PS: tomorrow I'll release a new SMReport Designer and SMReport Autogenerated.
In new distribution kit I shall include the new demo
application with sources, in which you can view a SetNodeState procedure using too.


Published: August 3, 1999

See also
 
ABA Database Convert
Protected Storage Viewer
DBExport tools
SMImport suite
DBISAM Password Recovery
ABA Picture Convert
DBLoad
MAPIMail
Paradox ActiveX
SMExport suite
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2025, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMReport Autogenerated