Monday, July 4, 2011

Few useful function in Lazarus

I randomly found and very easy function to copy files for "Save as..." function.
Simply include "ProjectTemplates" unit from lazarus\components\projecttemplates\ folder.


Function SimpleFileCopy(Const Source,Dest : String) : Boolean;  


As parameters you need to input what file to copy and define where to copy. It returns true if file copying
was successful.

Also I needed AnsiCompareString or CompareString from Delphi in Lazarus,to check if TListBox has same items. Luckily the Lazarus has alternative better method for comparing  two strings.

function SameText(const s1,s2:String):Boolean;


No comments: