home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue59 / Arch / Extended Sample / UnitFormListCustomer.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-05-19  |  1.5 KB  |  57 lines

  1. unit UnitFormListCustomer;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   UnitFormListBase, ActnList, Menus, Buttons, ComCtrls, ToolWin, StdCtrls,
  8.   ExtCtrls, UnitFrameResultSetBase, UnitFrameResultSetCustomer, ImgList;
  9.  
  10. type
  11.   TFormListCustomer = class(TFormListBase)
  12.     FrameResultSetCustomer: TFrameResultSetCustomer;
  13.     Label1: TLabel;
  14.     ComboBoxCompanyName: TComboBox;
  15.     EditCompanyName: TEdit;
  16.     procedure EditCompanyNameChange(Sender: TObject);
  17.   private
  18.     { Private declarations }
  19.   protected
  20.     function GetFrameResultSet: TFrameResultSetBase; override;
  21.     procedure InitializeForm; override;
  22.   public
  23.  
  24.   end;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. { TFormListCustomer }
  31.  
  32. function TFormListCustomer.GetFrameResultSet: TFrameResultSetBase;
  33. begin
  34.   Result := FrameResultSetCustomer;
  35. end;
  36.  
  37. procedure TFormListCustomer.EditCompanyNameChange(Sender: TObject);
  38. var s: string;
  39. begin
  40.   inherited;
  41.   case ComboBoxCompanyName.ItemIndex of
  42.     0: s := '(company like ''%'+EditCompanyName.Text+'%'')';
  43.     1: s := '(company like '''+EditCompanyName.Text+''')';
  44.     2: s := '(company like '''+EditCompanyName.Text+'%'')';
  45.     else // Unexpected value -- raise an exception or show an error msg.
  46.   end; // case
  47.   FrameResultSetCustomer.ResultSetObject.SqlWhereClause := s;
  48. end;
  49.  
  50. procedure TFormListCustomer.InitializeForm;
  51. begin
  52.   inherited;
  53.   ComboBoxCompanyName.ItemIndex := 0;
  54. end;
  55.  
  56. end.
  57.