Смекни!
smekni.com

Обделка вертикальных стволов (стр. 9 из 9)

WaitCursor := crSQLWait;

{ register classes of MDI-child forms }

{RegisterClasses([TDictForm, TRatesForm, TItemReportForm]);}

end;

procedure TStaftForm.FormDestroy(Sender: TObject);

begin

Screen.OnActiveFormChange := nil;

Application.HelpCommand(HELP_QUIT,0);

end;

procedure TStaftForm.InsuranceMenuItemClick(Sender: TObject);

begin

Form1.ShowModal;

end;

procedure TStaftForm.EditItemClick(Sender: TObject);

begin

EditDataForm.Show;

end;

end.

unit UserList;

interface

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,

Controls, Forms, Dialogs, DBCtrls, ExtCtrls, DBTables, DB, Grids,

DBGrids, RXDBCtrl, Placemnt, StdCtrls, Buttons;

type

TUserListForm = class(TForm)

UsersTable: TTable;

dsUsers: TDataSource;

UsersGrid: TrxDBGrid;

UsersTablePassword: TStringField;

Panel1: TPanel;

DBNavigator: TDBNavigator;

FormPlacement: TFormPlacement;

UsersTableID: TFloatField;

UsersTableUserName: TStringField;

UsersTableFullName: TStringField;

UsersTableUserLevel: TFloatField;

BitBtn1: TBitBtn;

procedure DBNavigatorClick(Sender: TObject; Button:

TNavigateBtn);

procedure UsersGridDblClick(Sender: TObject);

procedure FormPlacementSavePlacement(Sender: TObject);

procedure FormPlacementRestorePlacement(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

end;

var

UserListForm: TUserListForm;

implementation

uses

EditUser, IniFiles, Global;

const

SAccessDenied = 'Недостаточно прав. Доступ запрещен';

{$R *.DFM}

procedure TUserListForm.DBNavigatorClick(Sender: TObject;

Button: TNavigateBtn);

begin

case Button of

nbInsert:

begin

EditUserData('', UsersTable, True);

end;

nbEdit:

begin

EditUserData('', UsersTable, False);

end;

end;

end;

procedure TUserListForm.UsersGridDblClick(Sender: TObject);

begin

EditUserData('', UsersTable, False);

end;

procedure TUserListForm.FormPlacementSavePlacement(Sender: TObject);

var

IniFile: TIniFile;

I: Integer;

begin

IniFile := TIniFile.Create(FormPlacement.IniFileName);

try

for I := 0 to ComponentCount - 1 do begin

if Components[I] is TrxDBGrid then

TrxDBGrid(Components[I]).SaveLayout(IniFile);

end;

finally

IniFile.Free;

end;

end;

procedure TUserListForm.FormPlacementRestorePlacement(Sender:

TObject);

var

IniFile: TIniFile;

I: Integer;

begin

IniFile := TIniFile.Create(FormPlacement.IniFileName);

try

for I := 0 to ComponentCount - 1 do begin

if Components[I] is TrxDBGrid then

TrxDBGrid(Components[I]).RestoreLayout(IniFile);

end;

finally

IniFile.Free;

end;

end;

procedure TUserListForm.FormCreate(Sender: TObject);

begin

if not (glUserLevel in [ulAdministrator]) then begin

raise Exception.Create(SAccessDenied);

end;

UsersTable.Open;

end;

procedure TUserListForm.FormClose(Sender: TObject;

var

Action: TCloseAction);

begin

Action := caFree;

end;

end.

program Shaft;

uses

Forms,

Main in 'MAIN.PAS' {StaftForm},

Global in 'GLOBAL.PAS',

EditUser in 'EDITUSER.PAS',

UserList in 'USERLIST.PAS' {UserListForm},

Edittub in 'EDITTUB.PAS' {EditDataForm},

Editform in 'EDITFORM.PAS' {EdTubForm},

Calc1 in 'CALC1.PAS' {Form1},

Draw in 'DRAW.PAS' {DrawForm};

{$R *.RES}

begin

Application.CreateForm(TStaftForm, StaftForm);

Application.CreateForm(TEditDataForm, EditDataForm);

Application.CreateForm(TEdTubForm, EdTubForm);

Application.CreateForm(TForm1, Form1);

Application.CreateForm(TDrawForm, DrawForm);

Application.Run;

end.