[go: up one dir, main page]

Menu

[r71]: / trunk / hor_country.pas  Maximize  Restore  History

Download this file

113 lines (91 with data), 3.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
{
Health Organizer (http://sourceforge.net/projects/hor/,
http://hor.sourceforge.net/)
Copyright (C) 2014-2015 Andrea Urbani ( matfanjol@users.sf.net,
matfanjol@mail.com )
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit hor_country;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, Buttons;
type
{ TfrmCountry }
TfrmCountry = class(TForm)
btnCancel: TBitBtn;
btnOk: TBitBtn;
cmbCountry: TComboBox;
edtName: TEdit;
edtPhoneCode: TEdit;
lblCountry: TLabel;
lblName: TLabel;
lblPhoneCode: TLabel;
pnlCountry: TPanel;
pnlTop: TPanel;
pnlBottom: TPanel;
procedure btnOkClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
private
{ private declarations }
public
{ public declarations }
end;
var
frmCountry: TfrmCountry;
implementation
{$R *.lfm}
{ TfrmCountry }
uses hor_messages, LCLIntf;
procedure TfrmCountry.btnOkClick(Sender: TObject);
begin
if ( cmbCountry.ItemIndex < 0 ) then
begin
Messagedlg( rsMsgSelectAvalue, rsMsgSelectAvalue, mtError, [mbOk], 0 );
ModalResult:=mrNone;
end
else if ( cmbCountry.ItemIndex = ( cmbCountry.Items.Count - 1 ) ) then
begin
// "Other" was selected
if ( not pnlCountry.Visible ) then
begin
ModalResult := mrNone;
pnlCountry.Visible:=true;
if edtName.CanFocus then
edtName.SetFocus;
end
else if ( Trim( edtName.Text ) = '' ) then
begin
Messagedlg( rsMsgSelectAvalue, format( rsMsgTheFieldNeedsAvalue, [
lblName.Caption ] ), mtError, [mbOk], 0 );
ModalResult:=mrNone;
end
else if ( Trim( edtPhoneCode.Text ) = '' ) then
begin
Messagedlg( rsMsgSelectAvalue, format( rsMsgTheFieldNeedsAvalue, [
lblPhoneCode.Caption ] ), mtError, [mbOk], 0 );
ModalResult:=mrNone;
end;
if ( ( ModalResult = mrOK ) and
( MessageDlg( rsQMsgWouldYouLikeToSupportUs, format(
rsMsgWeHaveNoDataAboutCountry, [ edtName.Text ]) + LineEnding +
rsQMsgYouCouldHelpUsInFinding, mtConfirmation, [mbYes,mbNo], 0 )
= mrYes ) ) then
OpenURL('http://sourceforge.net/p/hor/tickets/');
end;
end;
procedure TfrmCountry.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caHide;
end;
end.