unit referee_meldingen;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,
ExtCtrls, ColorSpeedButton;
type
TMsgType = (mGeen, mInfo, mUitroep1, mUitroep2, mStop, mVraag1, mVraag2,
mBuis, mGo, mThink, mSign, mPotlood1, mPotlood2, mPDF, mKrant);
TMsgButton = (bYesNo, bOKCancel, bOK);
type
{ TForm_Melding }
TForm_Melding = class(TForm)
Button1: TColorSpeedButton;
Button2: TColorSpeedButton;
Image_Pop: TImage;
Label_Message: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word);
procedure FormShow(Sender: TObject);
private
{ private declarations }
MB: TMsgButton;
Custom: Boolean; // True -=> MSgCustom. False -=> Normal message
procedure Show_JuistePop(const MsgT: TMsgType);
public
{ public declarations }
procedure Melding (const MsgT: TMsgType; const MsgB: TMsgButton;
const MsgStr, MsgCaption: string);
procedure Melding_Alleen (const MsgT: TMsgType; const MsgStr, MsgCaption: string);
procedure Melding_Aangepast (const MsgT: TMsgType;
const MsgStr, MsgCaption: string;
const Btn1Msg, Btn2Msg: string;
const Btn1Gnr, Btn2Gnr: integer);
end;
var
Form_Melding: TForm_Melding;
implementation
{$R *.lfm}
uses LCLType,
referee_lint,
referee_types;
{ TForm_Melding }
procedure TForm_Melding.Button1Click(Sender: TObject);
begin
MessageButtonPressed := 0;
Close;
end; // Button1Click
procedure TForm_Melding.Button2Click(Sender: TObject);
begin
MessageButtonPressed := 1;
Close;
end; // Button2Click
procedure TForm_Melding.FormActivate(Sender: TObject);
begin
Button1.StateHover.Color := KleurPop + $00A0A000;
Button1.StateHover.BorderColor:= KleurPop;
Button1.StateActive.Color := Ribbon_Rood ;
Button1.StateActive.BorderColor:= clBlack;
Button2.StateHover.Color := KleurPop + $00A0A000;
Button2.StateHover.BorderColor:= KleurPop;
Button2.StateActive.Color := Ribbon_Rood ;
Button2.StateActive.BorderColor:= clBlack;
end; // FormActivate
procedure TForm_Melding.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
Form_Melding.FormStyle := fsNormal;
CloseAction := caHide;
end; // FormClose
procedure TForm_Melding.FormCreate(Sender: TObject);
begin
MessageButtonPressed := -1;
Button1.Visible := False;
Button2.Visible := False;
Color := Achter;
end; // FormCreate
procedure TForm_Melding.FormKeyDown(Sender: TObject; var Key: Word);
begin
if Custom = False then begin
case MB of
bOK : begin
if Key = VK_O then begin
Button1.Click;
Key := 0;
end;
end; // OK
bYesNo : begin
if Key = VK_Y then begin
Button1.Click;
Key := 0;
end;
if Key = VK_N then begin
Button2.Click;
Key := 0;
end;
end; // YesNo
bOKCancel : begin
if Key = VK_O then begin
Button1.Click;
Key := 0;
end;
if Key = VK_C then begin
Button2.Click;
Key := 0;
end;
end; // OKCancel
end; // MsgB
end; // if
end; // FormKeyDown
procedure TForm_Melding.FormShow(Sender: TObject);
begin
Form_Melding.FormStyle := fsSystemStayOnTop;
end; // FormShow
procedure TForm_Melding.Melding(const MsgT: TMsgType; const MsgB: TMsgButton;
const MsgStr, MsgCaption: string);
begin
Form_Melding.Height := 195;
MessageButtonPressed := -1;
Custom := False;
MB := MsgB;
Form_Melding.Caption := MsgCaption;
Label_Message.Caption := MsgStr;
case MsgT of
mGeen : begin
//Ook lblMessage verschuiven
Label_Message.Left := 10;
Label_Message.Top := 10;
Label_Message.Width := 400;
Show_JuistePop (mGeen);
end; // mNone
mStop : Show_JuistePop (mStop);
mInfo : Show_JuistePop (mInfo);
mVraag1 : Show_JuistePop (mVraag1);
mVraag2 : Show_JuistePop (mVraag2);
mUitroep1 : Show_JuistePop (mUitroep1);
mUitroep2 : Show_JuistePop (mUitroep2);
mBuis : Show_JuistePop (mBuis);
mGo : Show_JuistePop (mGo);
mThink : Show_JuistePop (mThink);
mSign : Show_JuistePop (mSign);
mPotlood1 : Show_JuistePop (mPotlood1);
mPotlood2 : Show_JuistePop (mPotlood2);
mPDF : Show_JuistePop (mPDF);
mKrant : Show_JuistePop (mKrant);
end; // MsgT
case MsgB of
bOK : begin
Button1.Left := 175;
Button1.Top := 145;
Button1.Caption := ' OK';
Button1.Visible := True;
Form_Lint.ImageList_Buttons_16.GetBitmap(0, Button1.Glyph);
Button2.Visible := False;
end; // OK
bYesNo : begin
Button1.Left := 95;
Button1.Top := 145;
Button1.Caption := 'Yes';
Button2.Caption := 'No';
Form_Lint.ImageList_Buttons_16.GetBitmap(0, Button1.Glyph);
Form_Lint.ImageList_Buttons_16.GetBitmap(5, Button2.Glyph);
Button1.Visible := True;
Button2.Visible := True;
end; // YesNo
bOKCancel : begin
Button1.Left := 95;
Button1.Top := 145;
Button1.Caption := 'Ok';
Button2.Caption := 'Cancel';
Form_Lint.ImageList_Buttons_16.GetBitmap(1, Button1.Glyph);
Form_Lint.ImageList_Buttons_16.GetBitmap(4, Button2.Glyph);
Button1.Visible := True;
Button2.Visible := True;
end; // OKCancel
end; // MsgB
ShowModal;
end; // Melding
procedure TForm_Melding.Melding_Alleen(const MsgT: TMsgType; const MsgStr, MsgCaption: string);
begin
Button1.Visible := False;
Button2.Visible := False;
Form_Melding.Caption := MsgCaption;
Label_Message.Caption := MsgStr;
case MsgT of
mGeen : begin
//Ook lblMessage verschuiven
Label_Message.Left := 10;
Label_Message.Top := 10;
Label_Message.Width := 400;
Show_JuistePop (mGeen);
end; // mNone
mStop : Show_JuistePop (mStop);
mInfo : Show_JuistePop (mInfo);
mVraag1 : Show_JuistePop (mVraag1);
mVraag2 : Show_JuistePop (mVraag2);
mUitroep1 : Show_JuistePop (mUitroep1);
mUitroep2 : Show_JuistePop (mUitroep2);
mBuis : Show_JuistePop (mBuis);
mGo : Show_JuistePop (mGo);
mThink : Show_JuistePop (mThink);
mSign : Show_JuistePop (mSign);
mPotlood1 : Show_JuistePop (mPotlood1);
mPotlood2 : Show_JuistePop (mPotlood2);
mPDF : Show_JuistePop (mPDF);
mKrant : Show_JuistePop (mKrant);
end; // MsgT
Form_Melding.Height := 145;
Form_Melding.FormStyle:=fsStayOnTop;
Show;
end; // Melding_Alleen
procedure TForm_Melding.Melding_Aangepast(const MsgT: TMsgType;
const MsgStr, MsgCaption: string;
const Btn1Msg, Btn2Msg: string;
const Btn1Gnr, Btn2Gnr: integer);
begin
Form_Melding.Height := 195;
MessageButtonPressed := -1;
Custom := True;
Form_Melding.Caption := MsgCaption;
Label_Message.Caption := MsgStr;
case MsgT of
mGeen : begin
//Ook lblMessage verschuiven
Label_Message.Left := 10;
Label_Message.Top := 10;
Label_Message.Width := 400;
Show_JuistePop (mGeen);
end; // mNone
mStop : Show_JuistePop (mStop);
mInfo : Show_JuistePop (mInfo);
mVraag1 : Show_JuistePop (mVraag1);
mVraag2 : Show_JuistePop (mVraag2);
mUitroep1 : Show_JuistePop (mUitroep1);
mUitroep2 : Show_JuistePop (mUitroep2);
mBuis : Show_JuistePop (mBuis);
mGo : Show_JuistePop (mGo);
mThink : Show_JuistePop (mThink);
mSign : Show_JuistePop (mSign);
mPotlood1 : Show_JuistePop (mPotlood1);
mPotlood2 : Show_JuistePop (mPotlood2);
mPDF : Show_JuistePop (mPDF);
mKrant : Show_JuistePop (mKrant);
end; // MsgT
Button1.Left := 95;
Button1.Top := 145;
Button1.Caption := ' ' + Btn1Msg;
Button2.Caption := ' ' + Btn2Msg;
if Btn1Gnr = -1 then
Button1.Glyph.Clear
else
Form_Lint.ImageList_Buttons_16.GetBitmap(Btn1Gnr, Button1.Glyph);
if Btn2Gnr = -1 then
Button1.Glyph.Clear
else
Form_Lint.ImageList_Buttons_16.GetBitmap(Btn2Gnr, Button2.Glyph);
Button1.Visible := True;
Button2.Visible := True;
ShowModal;
end; // Melding_Aangepast
procedure TForm_Melding.Show_JuistePop(const MsgT: TMsgType);
begin
case MsgT of
mGeen : Image_Pop.Picture.Bitmap.Assign(nil);
mInfo : Form_Lint.ImageList_Rood.GetBitmap(01,Image_Pop.Picture.Bitmap);
mUitroep1 : Form_Lint.ImageList_Rood.GetBitmap(00,Image_Pop.Picture.Bitmap);
mUitroep2 : Form_Lint.ImageList_Rood.GetBitmap(14,Image_Pop.Picture.Bitmap);
mStop : Form_Lint.ImageList_Rood.GetBitmap(05,Image_Pop.Picture.Bitmap);
mVraag1 : Form_Lint.ImageList_Rood.GetBitmap(03,Image_Pop.Picture.Bitmap);
mVraag2 : Form_Lint.ImageList_Rood.GetBitmap(13,Image_Pop.Picture.Bitmap);
mBuis : Form_Lint.ImageList_Rood.GetBitmap(02,Image_Pop.Picture.Bitmap);
mGo : Form_Lint.ImageList_Rood.GetBitmap(04,Image_Pop.Picture.Bitmap);
mThink : Form_Lint.ImageList_Rood.GetBitmap(06,Image_Pop.Picture.Bitmap);
mSign : Form_Lint.ImageList_Rood.GetBitmap(12,Image_Pop.Picture.Bitmap);
mPotlood1 : Form_Lint.ImageList_Rood.GetBitmap(08,Image_Pop.Picture.Bitmap);
mPotlood2 : Form_Lint.ImageList_Rood.GetBitmap(17,Image_Pop.Picture.Bitmap);
mPDF : Form_Lint.ImageList_Rood.GetBitmap(18,Image_Pop.Picture.Bitmap);
mKrant : Form_Lint.ImageList_Rood.GetBitmap(11,Image_Pop.Picture.Bitmap);
end; // MsgT
end; // Show_JuistePop
end.