3

Is there a built-in function in Delphi 7 that returns a TSize from a given cx and cy parameters?

Something similar to the functions Rect() and Point() etc...

I know that writing my own is very simple (although its a shame that Size is already an alias to TSize so I can't name my function Size). but I was wondering if there is a build-in function in the RTL.

3
  • Why not just use TSize.Create(cx, cy) ? Commented Dec 7, 2017 at 7:48
  • @ViRuSTriNiTy, how? TSize is a record type in Delphi 7. it has not Create method and records does not support methods or helpers in D7. Commented Dec 7, 2017 at 7:53
  • Ok, my bad. Didn't see the Delphi 7 tag. Commented Dec 7, 2017 at 8:02

1 Answer 1

5

There is no such built in function in the Delphi 7 RTL.

Sign up to request clarification or add additional context in comments.

8 Comments

Is there a function like this in newer versions? and I don't mean TSize.Create(cx, cy).
@Zig, no, there is not a standalone function even in recent version (Tokyo).
@Victoria, Thanks. As a bonus question, do you think naming such function as GetSize(cx, cy) is good convention?
I'd use Size. You aren't going to need the type SIZE so you can hide it. In the same way that the RTL hides the types RECT, POINT etc. with functions of the same name that return newly minted values.
But if you really want to avoid a name clash/hide, call it MakeSize. That clearly indicates what the function does, IMO.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.