unit publicunit;
interface
uses
Grids, Registry, Windows, Dialogs, printers, Classes, Forms;
procedure clear_grid(sender: tobject);
procedure delete_grid(grid: tstringgrid;
_rols: integer);
//procedure print;
// procedure PrintLine(Items: TStringList);
// procedure PrintHeader;
// procedure PrintColumnNames;
function GetShellFolders(strDir: string): string;
function setshowtoolbar(formcount: Integer): Boolean;
var
send_integer: integer;
showtoolsbar: Boolean;
PixelsInInchx: integer;
LineHeight: Integer;
AmountPrinted: integer;
TenthsOfInchPixelsY: integer;
implementation
{procedure print;
var
Items: TStringList;
begin
Items := TStringList.Create;
try
PixelsInInchx := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
TenthsOfInchPixelsY := GetDeviceCaps(Printer.Handle,
LOGPIXELSY) div 10;
AmountPrinted := 0;
Printer.begin
Doc;
Application.ProcessMessages;
LineHeight := Printer.Canvas.TextHeight('X') + TenthsOfInchPixelsY;
// PrintColumnNames;
// PrintLine(Items);
if AmountPrinted + LineHeight > Printer.PageHeight then
begin
AmountPrinted := 0;
if not Printer.Aborted then
Printer.NewPage;
// PrintHeader;
// PrintColumnNames;
end;
Items.Clear;
// tblClients.Next;
if not Printer.Aborted then
Printer.EndDoc;
finally
Items.Free;
end;
end;
}
function setshowtoolbar(formcount: integer): Boolean;
begin
Result := formcount = 1;
end;
procedure delete_grid(grid: tstringgrid;
_rols: integer);
var
temp_x, temp_y, temp_i: integer;
begin
if _rols = 2 then
begin
if grid.Cells[0, 1] <> '' then
begin
for temp_i := 0 to grid.ColCount - 1do
grid.Cells[temp_i, 1] := '';
send_integer := 0;
end
else
showmessage('&Atilde;&raquo;&Oacute;&ETH;&Ecirc;&yacute;&frac34;&Yacute;&iquest;&Eacute;&Ograve;&Ocirc;&Eacute;&frac34;&sup3;&yacute;.');
end
else
begin
for temp_y := grid.row to grid.RowCount - 1do
for temp_x := 0 to grid.ColCount - 1do
grid.Cells[temp_x, temp_y] := grid.Cells[temp_x, temp_y + 1];
grid.RowCount := pred(grid.RowCount);
send_integer := pred(grid.RowCount);
end;
end;
function GetShellFolders(strDir: string): string;
const
regPath = '/Software/Microsoft/Windows/CurrentVersion/Explorer/Shell Folders';
var
Reg: TRegistry;
strFolders: string;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey(regPath, false) then
begin
strFolders := Reg.ReadString(strDir);
end;
finally
Reg.Free;
end;
result := strFolders;
end;
procedure clear_grid(sender: tobject);
var temp_x, temp_y: integer;
begin
for temp_y := 1 to TStringGrid(sender).RowCount - 1do
for temp_x := 0 to TStringGrid(sender).ColCount - 1do
TStringGrid(sender).Cells[temp_x, temp_y] := '';
TStringGrid(sender).RowCount := 2;
end;
end.