I have a function which checks if a value was entered into the text of a TWebEdit. When nothing is entered, it returns an error message and sets focus to the TWebEdit. The compiler returns a fatal error for the line StringEdit.SetFocus:
[Fatal Error] Can't access protected member SetFocus
function RequireValue(StringEdit: TWebEdit; ErrorMessage: String): String;
var
StringValue: String;
begin
StringValue := Trim(StringEdit.Text);
if StringValue <> '' then
Result := ''
else
begin
Result := ErrorMessage;
StringEdit.SetFocus;
end;
end;