How can I compare two variables of TRect type?
var
r1, r1: TRect;
begin
if (r1 = r2) then
...
end;
With that above I get: Incompatible types.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you had a modern Delphi, then that code would compile and work. The
TRectin modern Delphi versions takes advantage of operator overloading to overload the equality operator. You simply cannot make that syntax work in Delphi 7 since there is no built in equality operator for Delphi records.Without that help from the compiler you need a helper function. You can write your own:
Although, as @Sertac points out, there’s little need to write your own
EqualRectwhen you can use the Windows API function of the same name.