Just add a simple method to the
TMyBox class, with one parameter (in the shape of
TNotifyEvent):
type
TMyBox = class(TCustomGroupBox)
{..}
protected
procedure ComboBoxChange(ASender: TObject); virtual;
{..}
end;
and assign it to the control event, right after its creation:
constructor TMyBox.Create(AOwner: TComponent);
var
i: integer;
begin
inherited Create(AOwner);
Parent := TWinControl(AOwner);
{..}
Lev := TComboBox.Create(Self);
Lev.OnChange := @ComboBoxChange;
{..}
end;
One additional thing — don't keep the references of the internal controls as public variables. Declare them as local and then declare a public properties with getters only. Generally, in this way:
type
TMyBox = class(TCustomGroupBox)
private
FLev: TComboBox;
FLab: TLabel;
{..}
public
property Lev: TComboBox read FLev;
property Lab: TLabel read FLab;
{..}
end;