Read Me for CybParentInfo

Just to show that the last 2 days of procrastination have not been totally wasted, I present CybParentInfo

This is a native delphi VCL that you can drop onto any form. It publishes only 2 properties  - well they're actually pseudoproperties just to load property editors. The "About" property is self explanotory I'm sure

The "Parentage" property editor pops up an Outline List of the Parent relations for all the tWinControls owned by the form.

Nothing Dramatic, but useful for debugging.

Installation

The Usual VCL install - Options | Install Components | Add then select the name of the registration bearing unit - in this case " cybparnt.pas".

No Help I'm afraid, but then you do get the source !

Use

Please use this any way you see fit. If you get it to owner draw, please let me have the code you used.  If you steal bits or distribute bits, then just acknowlefdge the bits that were mine.

Comments :

I tried to make this an Owner Draw tOutline, but to no avail. I've heard of bugs with this drawing style for these objects, and it got me too !

I kept getting an "index of out bounds" error within the OnDrawItem handler for the TOutline.

I have included the source for the editor which has the toutline, and you will see the Ondrawitem event there. It is not hooked up

Rest assured that my code that analyses the parent relations used to assign a suitable bitmap to the tOutlineNodes. Data property, using this code :

FUNCTION tCybFrmInfo.AddNode(addoutline : toutline; outlinendx : integer;
                    ctrl : twincontrol; bmpname : string;addaschild : boolean) : integer;
var
   pbmp : tbitmap;
   pc : pchar;
   ni : string;

Begin
  pbmp := tbitmap.create;
  pc := stralloc(80);
  strpcopy( pc ,uppercase(bmpname));
  pbmp.handle := loadbitmap(HInstance, pc);
  ni := nodeid(ctrl);
  if addaschild then result := addoutline.addchildobject(outlinendx, nodeid(ctrl), pointer(pbmp))
                else result := addoutline.addobject(outlinendx, nodeid(ctrl), pointer(pbmp));
  strdispose(pc);
End;

However I have since commented this out, because I hadn't implemented the destruction of these bmps, which noshed system resources. It now only use "add" and "addchild".

function tCybFrmInfo.NodeID(ctrl : twincontrol) : string;

Begin
  with ctrl do result := name+' : '+classname+';';
End;

and bmpname is assigned as 

ctrl.classname 

which should cause the bitmaps to load from Delphi's IDE resource file - each control should supply a bmp at registration time.

However, it don't work. Anybody who can  explain why it don't work  please let me know  how to fix it.(and send me a copy)!

Boris Ingram, Cyborg Software
borising@iafrica.com
http://www.pcb.co.za/users/borising/cyborg.htm



