Functions in unitUtils.pasFunctions in unitUtils.pas

You are here: Qixite :: Documentation :: Development Docs :: Functions in unitUtils.pas

getMemoText

function getMemoText(memo : TMemo) : WideString;
As Delphi Unicode support is in its infancy we (at least for memo fields) have to write our own workarounds for retrieving and setting Unicode values in memo.
Behaviour under Linux:
Just retrieve property Text.
Behaviour under Windows:
1. store current selection information
2. select everything and retrieve unicode value
3. restore previous selection

setMemoText

procedure setMemoText(memo : TMemo; txt : WideString);
As Delphi Unicode support is in its infancy we (at least for memo fields) have to write our own workarounds for retrieving and setting unicode values in memo.
This procedure clears memo and appends new value as direct assignment of property Text does not work well with vairables of type WideString.

openIniFile

function openIniFile : TIniFile;
Returns TIniFile type object pointing to user settings file if it exists, otherwise returns TIniFile type object pointing to global settings file. If none of the files exist throws an exception.
Windows:
Global settings file = qixite.ini in Windows directory
User settings file = qixite.ini in directory pointed by environment variable APPDATA
Linux:
Global settings file = qixite.ini in directory /etc
User settings file = qixite.ini in directory pointed by environment variable HOME

isInSubDir

function isInSubDir(directoryPath, filePath : String) : Boolean;
Return True if the file is located in the subdirectory of directory supplied. Otherwise return False.

addDirSeparatorIfNeeded

procedure addDirSeparatorIfNeeded(var directoryPath : String);
Linux:
append '/' if it is missing at the end of directoryPath
Windows:
append '\' if it is missing at the end of directoryPath

removeChr13

function removeChr13(s : WideString) : WideString;
Removes all char(13) from string and returns this new string.
It is used in Windows version only as reading and writing to TMemo adds excessive char(13) at each line break.

copyFile

function copyFile(source, destination : String) : Boolean;
Used to copy files.
It does not perform any validation. And does not change copy file permissions (Linux) or attributes (Windows)

copyFileToDirIfOutside

function copyFileToDirIfOutside(openDialog : TOpenDialog; copyToDir : String) : String;
1. Switch openDialog to copyToDir if this is first execution of openDialog.
2. If file selected is copyToDir copy it into that directory and return its name only.
3. If file is inside of copyToDir return its relative path.
4. Return empty string if function fails.
Last modified: 2002-10-21
SourceForge.net LogoCreated with Qixite