home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kolekce / d56 / RMCTL.ZIP / rmInspectorEdit2.pas < prev    next >
Pascal/Delphi Source File  |  2001-06-22  |  2KB  |  81 lines

  1. {================================================================================
  2. Copyright (C) 1997-2001 Mills Enterprise
  3.  
  4. Unit     : rmInspectorItems
  5. Purpose  : This is a designtime unit to help with selecting and creating
  6.            rmInspectorItems.
  7. Date     : 01-18-2001
  8. Author   : Ryan J. Mills
  9. Version  : 1.80
  10. ================================================================================}
  11.  
  12. unit rmInspectorEdit2;
  13.  
  14. interface
  15.  
  16. {$I CompilerDefines.INC}
  17.  
  18. uses
  19.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  20.   StdCtrls, rmInspector;
  21.  
  22. type
  23.   TfrmInspectorItemTypes = class(TForm)
  24.     ComboBox1: TComboBox;
  25.     Label1: TLabel;
  26.     Button1: TButton;
  27.     Button2: TButton;
  28.     procedure FormCreate(Sender: TObject);
  29.   private
  30.     function GetItemType: TrmCustomInspectorItemClass;
  31.     procedure SetItemType(const Value: TrmCustomInspectorItemClass);
  32.     { Private declarations }
  33.   public
  34.     { Public declarations }
  35.     property ChosenType:TrmCustomInspectorItemClass read GetItemType write SetItemType;
  36.   end;
  37.  
  38. implementation
  39.  
  40. {$R *.DFM}
  41.  
  42. uses rmInspectorItems;
  43.  
  44. procedure TfrmInspectorItemTypes.FormCreate(Sender: TObject);
  45. begin
  46.    ComboBox1.ItemIndex := 0;
  47. end;
  48.  
  49. function TfrmInspectorItemTypes.GetItemType: TrmCustomInspectorItemClass;
  50. begin
  51.    case ComboBox1.itemindex of
  52.      0:result := TrmCheckboxInspectorItem;
  53.      1:result := TrmComboInspectorItem;
  54.      2:result := TrmComplexInspectorItem;
  55.      3:result := TrmDateInspectorItem;
  56.      4:result := TrmIntegerInspectorItem;
  57.      5:result := TrmStringInspectorItem;
  58.    else
  59.       raise exception.create('Unknown item index');
  60.    end
  61. end;
  62.  
  63. procedure TfrmInspectorItemTypes.SetItemType(
  64.   const Value: TrmCustomInspectorItemClass);
  65. begin
  66.    if Value = TrmComboInspectorItem then
  67.       ComboBox1.itemindex := 0
  68.    else if Value = TrmComplexInspectorItem then
  69.       ComboBox1.itemindex := 1
  70.    else if Value = TrmDateInspectorItem then
  71.       ComboBox1.itemindex := 2
  72.    else if Value = TrmIntegerInspectorItem then
  73.       ComboBox1.itemindex := 3
  74.    else if Value = TrmStringInspectorItem then
  75.       ComboBox1.itemindex := 4
  76.    else
  77.      raise exception.create('Unknown Item Class')
  78. end;
  79.  
  80. end.
  81.