I came across this topic after facing the same problem.Eventually, I ended up creating a Delphi-like procedure for Lazarus: