What's wrong? (Expression type must be BOOLEAN)

What's wrong with my code? I am getting this error:

[error dcc32] Unit6.pas (83): E2012 Expression type must be BOOLEAN

function checkver(): boolean;
begin
  //some code here
end;

function refresh(): boolean;
begin
  //some code here
end;

procedure TForm6.FormCreate(Sender: TObject);
begin
  if checkver() then
    if refresh() then  //Error is HERE!!
      //some code here
end;

      

( full code )

+3


source to share


1 answer


TControl

(from which your form class is generated) has a Refresh

method of its own
and it does not return a boolean. The scope of this method is closer than the scope of a single-level method of the same name, because you write code in a method of that class, so the compiler binds to the method Refresh

, not the function Refresh

.



Call <unitname>.refresh

to get a unit level function instead of a method.

+18


source







All Articles