> I need to pass the current control the user is siting on to
> the component created in the controls class.
I don't understand what you are referring to. Please clearify.
> Basically I am modifying the TCheckList box for accessibility,
> I need the new class that derives the IAccessible implementatios's
> create procedure to look like:
> TCheckLostAccessible.create(CheckList: TChecklistbox);
Why not derive TCheckListAccessible directly from TCheckListBox, instead of
trying to attach it to a separate object?
type
TCheckListAccessible = class(TCheckListBox, IAccessible)
...
end;
That way, IAccessible has direct access to the TCheckListBox and its
members. You coudl then use TCheckListAccessible instead of a normal
TCheckListBox in your UI.
> How do I obtain the CheckLostBox from tit's own class
Since you are already passing the TCheckListBox pointer to your
TCheckListAccessible constructor, why not just store it as a member of the
class? Then you don't have to go hunting around for it at all, ie:
type
TCheckListAccessible = class(IAccessible)
private
FListBox: TCheckListBox;
...
public
constructor Create(ACheckList: TCheckListBox);
end;
constructor TCheckListAccessible.Create(ACheckList: TCheckListBox);
begin
inherited Create;
FListBox := ACheckList;
end;
Better would be to derive TCheckListAccessible from TComponent so you can
hook up the TCheckListBox to the TCheckListAccessible at design time, ie:
type
TCheckListAccessible = class(TComponent, IAccessible)
private
FListBox: TCheckListBox;
procedure SetListBox(Value: TCheckListBox);
...
protected
procedure Notification(AComponent: TComponent: Operation:
TOperation); override;
...
published
property ListBox: TCheckListBox read FListBox write SetListBox;
end;
procedure TCheckListAccessible.SetListBox(Value: TCheckListBox);
begin
if FListBox <> Value then
begin
if FListBox <> nil then FListBox.RemoveFreeNotification(Self);
FListBox := Value;
if FListBox <> nil then FListBox.FreeNotification(Self);
end;
end;
procedure TCheckListAccessible.Notification(AComponent: TComponent:
Operation: TOperation);
begin
inherited;
if (FListBox = AComponent) and (Operation = opRemove) then
FListBox := nil;
end;
Gambit