Tree View doesn't paint its items inside a COM Object
Hi,
I'm trying to implement a com object whose purpose is to create a User
Interface.
That User Interface contains a Tree View. The problem comes when I insert
some items into the Tree View, they are there but are not displayed. I even
tried to make it a custom draw control but the event is never called. I
tried subclassing my own class to override the CustomDraw and CustomDrawItem
methods but the same happens, they are not called.
I tested the same thing but in the MyForm.OnCreate event and it works, the
problem seems to come when the Tree View is created inside the com object.
I'm using Win95 version 4.00.950 B with Internet Explorer 4.0 version
4.72.2106.8. I upgraded the comctrl32.dll file so now the version of this
file is 4.72.3611.1900 but the result is the same.
Please I would appreciate any help, any clue,
This is my code:
IMyUserInterface = interface(IUnknown)
['{1CA521A0-AD5A-26B2-97CB-25C637A38652}']
function CreateAndPopulate(ParentWnd: LongWord): HResult; stdcall;
end;
TMyUserInterface = class(TComObject, IMyUserInterface)
protected
{Declare IMyUserInterface methods here}
function CreateAndPopulate(ParentWnd: LongWord): HResult; stdcall;
end;
The implementation of this method is:
function CreateAndPopulate(ParentWnd: LongWord): HResult;
begin
TvwInfo := TTreeView.Create(nil);
with TvwInfo do
begin
ParentWindow := ParentWnd;
Left := 10;
Top := 10;
Width := 200;
Height := 250;
TabOrder := 0;
Ctl3D := true;
BorderStyle := bsSingle;
end;
TvwInfo.Items.Add(nil, 'Item 1');
TvwInfo.Items.Add(nil, 'Item 2');
end;
The way this com object is called is this:
MyUI := CreateComObject(Class_MyUserInterface) as IMyUserInterface;
MyUI.CreateAndPopulate(Self.Handle);
Thanks a lot...