Prvni verze
This commit is contained in:
124
_plgPlan/frmZavady.pas
Normal file
124
_plgPlan/frmZavady.pas
Normal file
@ -0,0 +1,124 @@
|
||||
unit frmZavady;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Data.DB, Vcl.Grids, Vcl.DBGrids, JvExDBGrids,
|
||||
JvDBGrid, ddPlugin_TLB, Vcl.ComCtrls, JvExComCtrls, JvHeaderControl, Vcl.StdCtrls, Vcl.Buttons,
|
||||
Vcl.Mask, RzEdit;
|
||||
|
||||
type
|
||||
TformZavady = class(TForm)
|
||||
Panel1: TPanel;
|
||||
grdZavady: TJvDBGrid;
|
||||
grd1: TGridPanel;
|
||||
procedure FormShow (Sender: TObject);
|
||||
procedure grdZavadyDblClick (Sender: TObject);
|
||||
procedure FormClose (Sender: TObject; var Action: TCloseAction);
|
||||
procedure grdZavadyDrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
|
||||
private
|
||||
public
|
||||
Helios: IHelios;
|
||||
retVal: integer;
|
||||
idPrP: integer;
|
||||
nazev: string;
|
||||
kodModif: string;
|
||||
end;
|
||||
|
||||
var
|
||||
formZavady: TformZavady;
|
||||
|
||||
implementation
|
||||
uses System.StrUtils,
|
||||
helUtils, datMod2;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TformZavady.FormClose (Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
Action:= TCloseAction.caFree;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TformZavady.FormShow (Sender: TObject);
|
||||
var pomHandle: THandle;
|
||||
begin
|
||||
retVal:= 0;
|
||||
|
||||
|
||||
pomHandle:= THandle(Helios.MainApplicationHandle);
|
||||
if (pomHandle<>Application.Handle) then
|
||||
Application.Handle:= pomHandle;
|
||||
|
||||
pomHandle:= THandle(Helios.MainApplicationIconHandle);
|
||||
if (pomHandle<>Application.Icon.Handle) then
|
||||
Application.Icon.Handle:= pomHandle;
|
||||
|
||||
with Application.DefaultFont do
|
||||
begin
|
||||
Name:= Helios.Font;
|
||||
Height:= Helios.FontHeight;
|
||||
Charset:= Helios.Charset;
|
||||
|
||||
Screen.MenuFont.Charset:= Charset;
|
||||
Screen.MenuFont.Name:= Name;
|
||||
Screen.MenuFont.Height:= Height;
|
||||
end;
|
||||
|
||||
self.Font:= Application.DefaultFont;
|
||||
|
||||
|
||||
if not(dm2.vtZavady.Active) then
|
||||
dm2.vtZavady.Open;
|
||||
|
||||
dm2.vtZavady.EmptyDataSet;
|
||||
dm2.vtZavady.Filtered:= false;
|
||||
|
||||
grdZavady.LockDrawing;
|
||||
dm2.NactiUdrzbu (kodModif, 'Typ=3'); // prostoj stroje
|
||||
dm2.vtZavady.First;
|
||||
grdZavady.UnlockDrawing;
|
||||
|
||||
helUtils.waitEnd;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TformZavady.grdZavadyDblClick (Sender: TObject);
|
||||
var i, zm: integer;
|
||||
sz,rc,naz: string;
|
||||
begin
|
||||
i:= dm2.vtZavady.FieldByName('colID').AsInteger;
|
||||
naz:= dm2.vtZavady.FieldByName('colNazev').AsString;
|
||||
|
||||
if (Helios.YesNo('Chcete vybrat ' + #1 + naz + #1 + ' ?', true)) then
|
||||
begin
|
||||
idPrP:= i;
|
||||
nazev:= naz;
|
||||
retVal:= 10;
|
||||
Close;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TformZavady.grdZavadyDrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
|
||||
begin
|
||||
if (gdSelected in State) then
|
||||
grdZavady.Canvas.Font.Color:= clBlack;
|
||||
|
||||
grdZavady.Canvas.Brush.Color:= $00B8C4C8; // RGB C8C4B8 - seda
|
||||
if (Assigned(Column.Field) and (SameText(Column.FieldName, 'colNazev'))) then
|
||||
// if (Column.FieldName='colNazev') then
|
||||
grdZavady.Canvas.Brush.Color:= $00C6FECF; // RGB CFFEC6 - svetle zelena
|
||||
|
||||
|
||||
grdZavady.DefaultDrawColumnCell (Rect, DataCol, Column, State);
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user