TApxComPort.RegisterUser

TApxComPort

procedure RegisterUser(const H : QObjectH);

Registers a component that uses TApxComPort.

This method is primarily for internal use. It registers H, the handle of a TControl-derived component, as a user of this TApxComPort. All components registered with RegisterUser receive APX_PORTOPEN and APX_PORTCLOSE messages when the port is physically opened or closed (when the Open property changes). Due to the layered architecture of Async Professional CLX, this is sometimes essential for its supplied components (TTerminal, TProtocol, etc.). It's rarely necessary for your components, however, as long as they restrict themselves to documented TApxComPort properties and methods.

The following example is a custom component's Notification method that registers itself with the TApxComPort when that component is dropped on a form:

procedure TMyDerivedComPortUser.Notification(
  AComponent : TComponent; Operation : TOperation);
begin
  inherited Notification(AComponent, Operation);
  if Operation = opInsert then begin
    if (not Assigned(FComPort)) and (AComponent is TApxComPort)
then begin
      FComPort := TApxComPort(AComponent);
      FComPort.RegisterUser(Handle);
    end;
  end else begin
    ...
  end;
end;