home *** CD-ROM | disk | FTP | other *** search
/ Freelog 11 / Freelog011.iso / BestOf / PhoenixMail / Source / phoenix / FMEditAdr.pas < prev    next >
Pascal/Delphi Source File  |  1999-02-05  |  4KB  |  127 lines

  1. {*****************************************************************************
  2.  *
  3.  *  FMEditAdr.pas - Edit Address Form  (20-August-1998)
  4.  *
  5.  *  Copyright (c) 1998-99 Michael Haller
  6.  *
  7.  *  Author:     Michael Haller
  8.  *  E-mail:     michael@discountdrive.com
  9.  *  Homepage:   http://www.discountdrive.com/sunrise
  10.  *
  11.  *  This program is free software; you can redistribute it and/or
  12.  *  modify it under the terms of the GNU General Public License
  13.  *  as published by the Free Software Foundation;
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  23.  *
  24.  *----------------------------------------------------------------------------
  25.  *
  26.  *  Revision history:
  27.  *
  28.  *     DATE     REV                 DESCRIPTION
  29.  *  ----------- --- ----------------------------------------------------------
  30.  *
  31.  *****************************************************************************}
  32.  
  33. unit FMEditAdr;
  34.  
  35. interface
  36.  
  37. uses
  38.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  39.   ExtCtrls, StdCtrls, ComboBoxEx, LangSup, ComCtrls, PXStuff;
  40.  
  41. type
  42.   TEditAdrForm = class(TForm)
  43.     Button1: TButton;
  44.     Button2: TButton;
  45.     Panel1: TPanel;
  46.     PageControl1: TPageControl;
  47.     TabSheet1: TTabSheet;
  48.     Bevel5: TBevel;
  49.     Label16: TLabel;
  50.     Panel2: TPanel;
  51.     Image1: TImage;
  52.     Image2: TImage;
  53.     Label11: TLabel;
  54.     Label1: TLabel;
  55.     Label2: TLabel;
  56.     Label3: TLabel;
  57.     Label4: TLabel;
  58.     Label5: TLabel;
  59.     Label6: TLabel;
  60.     Label7: TLabel;
  61.     Edit1: TEdit;
  62.     Edit2: TEdit;
  63.     Edit3: TEdit;
  64.     Edit4: TEdit;
  65.     ComboBox1: TComboBoxEx;
  66.     Edit5: TEdit;
  67.     ComboBoxEx1: TComboBoxEx;
  68.     Button3: TButton;
  69.     procedure FormCreate(Sender: TObject);
  70.     procedure Button1Click(Sender: TObject);
  71.   private
  72.     { Private declarations }
  73.   public
  74.     { Public declarations }
  75.     CheckUnique: Boolean;
  76.   end;
  77.  
  78. var
  79.   EditAdrForm: TEditAdrForm;
  80.  
  81. implementation
  82.  
  83. uses
  84.   FMAddress, Main;
  85.  
  86. {$R *.DFM}
  87.  
  88. procedure TEditAdrForm.FormCreate(Sender: TObject);
  89. begin
  90.   AttachLanguageToForm(Self);
  91.   if bOfficeFonts then Font.Name := sOfficeFontName;
  92.   ComboBox1.Images := AddressForm.ImageList1;
  93.   ComboBoxex1.Images := AddressForm.ImageList1;
  94.   ComboBox1.Items.Assign(AddressForm.ComboBox1.Items);
  95.   ComboBox1.Values.Assign(AddressForm.ComboBox1.Values);
  96.   ComboBox1.ImgIndexes.Assign(AddressForm.ComboBox1.ImgIndexes);
  97.   ComboBox1.ItemIndex := 0;
  98.   ComboBoxEx1.ItemIndex := 0;
  99.   Label16.Caption := Label16.Caption+' ';
  100.   Image1.Picture.Bitmap := MainForm.Image5.Picture.Bitmap;
  101. end;
  102.  
  103. procedure TEditAdrForm.Button1Click(Sender: TObject);
  104. var
  105.   S: String;
  106.   I: Integer;
  107. begin
  108.   if CheckUnique then begin
  109.     if ComboBox1.ItemIndex = AddressForm.Combobox1.ItemIndex then
  110.       if Edit2.Text <> '' then
  111.         for I := 0 to AddressForm.ListView1.Items.Count-1 do
  112.           if LowerCase(AddressForm.ListView1.Items[I].SubItems[2]) = LowerCase(Edit2.Text) then begin
  113.             if MessageDlg(MainForm.ListBox1.Items[78], mtConfirmation, [mbYes, mbNo], 0) = mrNo then Exit;
  114.             Break;
  115.           end;
  116.   end;
  117.   S := Edit1.Text+Edit2.Text+Edit3.Text+Edit4.Text+Edit5.Text;
  118.   for I := 1 to Length(S) do
  119.     if S[I] in [','] then begin
  120.       MessageDlg(MainForm.ListBox1.Items[49], mtWarning, [mbOK], 0);
  121.       Exit;
  122.     end;
  123.    ModalResult := mrOK;
  124. end;
  125.  
  126. end.
  127.