saeidsg
شنبه 07 اردیبهشت 1398, 20:22 عصر
unit UCartTimeIn;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Mask, Menus, cxLookAndFeelPainters,
cxButtons;
type
TCatrTimeIn = class(TForm)
Panel2: TPanel;
Panel3: TPanel;
P01: TPanel;
P02: TPanel;
P03: TPanel;
P04: TPanel;
P05: TPanel;
P06: TPanel;
P07: TPanel;
P08: TPanel;
P09: TPanel;
P10: TPanel;
P11: TPanel;
P12: TPanel;
P13: TPanel;
P14: TPanel;
P15: TPanel;
P16: TPanel;
P17: TPanel;
P18: TPanel;
P19: TPanel;
P20: TPanel;
P21: TPanel;
P22: TPanel;
P23: TPanel;
P24: TPanel;
P25: TPanel;
P26: TPanel;
P27: TPanel;
P28: TPanel;
P29: TPanel;
P30: TPanel;
P31: TPanel;
Panel1: TPanel;
Panel20: TPanel;
Panel36: TPanel;
Panel37: TPanel;
TitelMountPnl: TPanel;
Panel5: TPanel;
NewB: TcxButton;
SaveB: TcxButton;
EditB: TcxButton;
DelB: TcxButton;
ExitB: TcxButton;
Procedure CreatItem;
Procedure TimeInOutMsk_KeyPress(Sender: TObject; var Key: Char);
procedure TimeInOutMsk_Exit(Sender: TObject);
Procedure PanelClicked(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CatrTimeIn: TCatrTimeIn;
PanelDay : array Of TPanel;
TimeInMsk_In_Out : array Of TMaskEdit;
iCountMsk : Byte;
implementation
uses UDate, StrUtils;
{$R *.dfm}
Procedure TCatrTimeIn.CreatItem;
var
iCountPanel : Integer;
LeftButoon : Integer;
TopButoon : Integer;
begin
LeftButoon := 544;
TopButoon := 82;
SetLength(PanelDay, 31);
for iCountPanel := 0 to 30 do begin
PanelDay[iCountPanel] := TPanel.Create(nil);
PanelDay[iCountPanel].Parent := CatrTimeIn;
PanelDay[iCountPanel].Visible := True;
PanelDay[iCountPanel].Caption := TitelMountPnl.Caption;
PanelDay[iCountPanel].Top := TopButoon;
PanelDay[iCountPanel].Left := LeftButoon;
PanelDay[iCountPanel].Height := 23;
PanelDay[iCountPanel].Width := 185;
PanelDay[iCountPanel].OnClick := CatrTimeIn.PanelClicked;
TopButoon := TopButoon + 23;
if iCountPanel = 15 then begin
TopButoon := 82;
LeftButoon := 160;
end;
end;
//------------------------------------------------------------------------------
LeftButoon := 473;
TopButoon := 82;
SetLength(TimeInMsk_In_Out, 62);
for iCountPanel := 0 to 61 do begin
TimeInMsk_In_Out[iCountPanel] := TMaskEdit.Create(nil);
TimeInMsk_In_Out[iCountPanel].Parent := CatrTimeIn;
TimeInMsk_In_Out[iCountPanel].Visible := True;
TimeInMsk_In_Out[iCountPanel].EditMask := '##:##:##';
TimeInMsk_In_Out[iCountPanel].Font.Size := 11;
TimeInMsk_In_Out[iCountPanel].Font.Style := [fsBold];
TimeInMsk_In_Out[iCountPanel].Top := TopButoon;
TimeInMsk_In_Out[iCountPanel].Left := LeftButoon;
TimeInMsk_In_Out[iCountPanel].Height := 24;
TimeInMsk_In_Out[iCountPanel].Width := 70;
TimeInMsk_In_Out[iCountPanel].Tag := iCountPanel;
TimeInMsk_In_Out[iCountPanel].OnKeyPress := CatrTimeIn.TimeInOutMsk_KeyPress;
TimeInMsk_In_Out[iCountPanel].OnExit := CatrTimeIn.TimeInOutMsk_Exit;
if iCountPanel <= 30 then begin
if iCountPanel Mod 2 = 0 then begin
LeftButoon := 388;
end else begin
LeftButoon := 473;
TopButoon := TopButoon + 23;
end;
end else begin
if iCountPanel = 31 then
TopButoon := 59;
if iCountPanel Mod 2 = 0 then begin
LeftButoon := 5;
end else begin
LeftButoon := 90;
TopButoon := TopButoon + 23;
end;
end;
end;
//------------------------------------------------------------------------------
end;
procedure TCatrTimeIn.TimeInOutMsk_KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then perform(wm_nextdlgctl,0,0);
end;
procedure TCatrTimeIn.TimeInOutMsk_Exit(Sender: TObject);
var
i : Byte;
StrText : String;
begin
StrText := '';
for i := 1 to 8 do begin
if MidStr(TimeInMsk_In_Out[iCountMsk].Text,i,1) = ' ' then
StrText := StrText + '0'
else
StrText :=StrText + MidStr(TimeInMsk_In_Out[iCountMsk].Text,i,1);
end;
TimeInMsk_In_Out[iCountMsk].Text := StrText;
Inc(iCountMsk);
end;
Procedure TCatrTimeIn.PanelClicked(Sender: TObject);
begin
ShowMessage('');
end;
procedure TCatrTimeIn.FormShow(Sender: TObject);
var
Str : String;
begin
TitelMountPnl.Caption := ProcDateMount(DateGlobal)+' '+MidStr(DateGlobal,1,4);
//DayP01.Caption := ProcDayOfWeekSel('1398\02\01');
end;
procedure TCatrTimeIn.FormCreate(Sender: TObject);
begin
CreatItem;
iCountMsk := 0;
end;
end.
سلام وقتی ساخته می شود می خواهم به یکی از ایتم ها مراجعه کنم چظوری ایندکس رو پیدا کنم ممنون کمک کنید
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Mask, Menus, cxLookAndFeelPainters,
cxButtons;
type
TCatrTimeIn = class(TForm)
Panel2: TPanel;
Panel3: TPanel;
P01: TPanel;
P02: TPanel;
P03: TPanel;
P04: TPanel;
P05: TPanel;
P06: TPanel;
P07: TPanel;
P08: TPanel;
P09: TPanel;
P10: TPanel;
P11: TPanel;
P12: TPanel;
P13: TPanel;
P14: TPanel;
P15: TPanel;
P16: TPanel;
P17: TPanel;
P18: TPanel;
P19: TPanel;
P20: TPanel;
P21: TPanel;
P22: TPanel;
P23: TPanel;
P24: TPanel;
P25: TPanel;
P26: TPanel;
P27: TPanel;
P28: TPanel;
P29: TPanel;
P30: TPanel;
P31: TPanel;
Panel1: TPanel;
Panel20: TPanel;
Panel36: TPanel;
Panel37: TPanel;
TitelMountPnl: TPanel;
Panel5: TPanel;
NewB: TcxButton;
SaveB: TcxButton;
EditB: TcxButton;
DelB: TcxButton;
ExitB: TcxButton;
Procedure CreatItem;
Procedure TimeInOutMsk_KeyPress(Sender: TObject; var Key: Char);
procedure TimeInOutMsk_Exit(Sender: TObject);
Procedure PanelClicked(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CatrTimeIn: TCatrTimeIn;
PanelDay : array Of TPanel;
TimeInMsk_In_Out : array Of TMaskEdit;
iCountMsk : Byte;
implementation
uses UDate, StrUtils;
{$R *.dfm}
Procedure TCatrTimeIn.CreatItem;
var
iCountPanel : Integer;
LeftButoon : Integer;
TopButoon : Integer;
begin
LeftButoon := 544;
TopButoon := 82;
SetLength(PanelDay, 31);
for iCountPanel := 0 to 30 do begin
PanelDay[iCountPanel] := TPanel.Create(nil);
PanelDay[iCountPanel].Parent := CatrTimeIn;
PanelDay[iCountPanel].Visible := True;
PanelDay[iCountPanel].Caption := TitelMountPnl.Caption;
PanelDay[iCountPanel].Top := TopButoon;
PanelDay[iCountPanel].Left := LeftButoon;
PanelDay[iCountPanel].Height := 23;
PanelDay[iCountPanel].Width := 185;
PanelDay[iCountPanel].OnClick := CatrTimeIn.PanelClicked;
TopButoon := TopButoon + 23;
if iCountPanel = 15 then begin
TopButoon := 82;
LeftButoon := 160;
end;
end;
//------------------------------------------------------------------------------
LeftButoon := 473;
TopButoon := 82;
SetLength(TimeInMsk_In_Out, 62);
for iCountPanel := 0 to 61 do begin
TimeInMsk_In_Out[iCountPanel] := TMaskEdit.Create(nil);
TimeInMsk_In_Out[iCountPanel].Parent := CatrTimeIn;
TimeInMsk_In_Out[iCountPanel].Visible := True;
TimeInMsk_In_Out[iCountPanel].EditMask := '##:##:##';
TimeInMsk_In_Out[iCountPanel].Font.Size := 11;
TimeInMsk_In_Out[iCountPanel].Font.Style := [fsBold];
TimeInMsk_In_Out[iCountPanel].Top := TopButoon;
TimeInMsk_In_Out[iCountPanel].Left := LeftButoon;
TimeInMsk_In_Out[iCountPanel].Height := 24;
TimeInMsk_In_Out[iCountPanel].Width := 70;
TimeInMsk_In_Out[iCountPanel].Tag := iCountPanel;
TimeInMsk_In_Out[iCountPanel].OnKeyPress := CatrTimeIn.TimeInOutMsk_KeyPress;
TimeInMsk_In_Out[iCountPanel].OnExit := CatrTimeIn.TimeInOutMsk_Exit;
if iCountPanel <= 30 then begin
if iCountPanel Mod 2 = 0 then begin
LeftButoon := 388;
end else begin
LeftButoon := 473;
TopButoon := TopButoon + 23;
end;
end else begin
if iCountPanel = 31 then
TopButoon := 59;
if iCountPanel Mod 2 = 0 then begin
LeftButoon := 5;
end else begin
LeftButoon := 90;
TopButoon := TopButoon + 23;
end;
end;
end;
//------------------------------------------------------------------------------
end;
procedure TCatrTimeIn.TimeInOutMsk_KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then perform(wm_nextdlgctl,0,0);
end;
procedure TCatrTimeIn.TimeInOutMsk_Exit(Sender: TObject);
var
i : Byte;
StrText : String;
begin
StrText := '';
for i := 1 to 8 do begin
if MidStr(TimeInMsk_In_Out[iCountMsk].Text,i,1) = ' ' then
StrText := StrText + '0'
else
StrText :=StrText + MidStr(TimeInMsk_In_Out[iCountMsk].Text,i,1);
end;
TimeInMsk_In_Out[iCountMsk].Text := StrText;
Inc(iCountMsk);
end;
Procedure TCatrTimeIn.PanelClicked(Sender: TObject);
begin
ShowMessage('');
end;
procedure TCatrTimeIn.FormShow(Sender: TObject);
var
Str : String;
begin
TitelMountPnl.Caption := ProcDateMount(DateGlobal)+' '+MidStr(DateGlobal,1,4);
//DayP01.Caption := ProcDayOfWeekSel('1398\02\01');
end;
procedure TCatrTimeIn.FormCreate(Sender: TObject);
begin
CreatItem;
iCountMsk := 0;
end;
end.
سلام وقتی ساخته می شود می خواهم به یکی از ایتم ها مراجعه کنم چظوری ایندکس رو پیدا کنم ممنون کمک کنید