home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Delphi.5 / Samples / sourceD5 / browutil.exe / BROWSER / SELINDEX.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-08-18  |  1.1 KB  |  51 lines

  1. unit SelIndex;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, DB;
  8.  
  9. type
  10.   TFrmSelectIndex = class(TForm)
  11.     Panel1: TPanel;
  12.     BtnOk: TButton;
  13.     BtnClose: TButton;
  14.     ComboBox1: TComboBox;
  15.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.     function OpenIndex(IndexDefs : TIndexDefs;sIndexFieldNames : String) : String;
  21.   end;
  22.  
  23. var
  24.   FrmSelectIndex: TFrmSelectIndex;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. function TFrmSelectIndex.OpenIndex(IndexDefs : TIndexDefs; sIndexFieldNames : String) : String;
  31. var
  32.   I : Integer;
  33. begin
  34.   Result := sIndexFieldNames;
  35.   IndexDefs.Update;
  36.   ComboBox1.Items.Clear;
  37.   ComboBox1.Text := sIndexFieldNames;
  38.   for I := 0 to IndexDefs.Count - 1 do
  39.     ComboBox1.Items.Add(IndexDefs.Items[I].Fields);
  40.   if (Self.ShowModal = mrOk) then
  41.     Result := ComboBox1.Items[ComboBox1.ItemIndex];
  42. end;
  43.  
  44. procedure TFrmSelectIndex.FormClose(Sender: TObject;
  45.   var Action: TCloseAction);
  46. begin
  47.   Action := caFree;
  48. end;
  49.  
  50. end.
  51.