unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, NxPropertyItems, NxPropertyItemClasses,
  ImgList, StdCtrls, XPMan, NxEdit, NxScrollControl,
  NxInspector;

type
  TForm1 = class(TForm)
    ImageList1: TImageList;
    NxComboBoxItem1: TComboBox;
    Label1: TLabel;
    CheckBox1: TCheckBox;
    Label2: TLabel;
    SpinEditor1: TNxSpinEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    XPManifest1: TXPManifest;
    Button4: TButton;
    CheckBox2: TCheckBox;
    Button5: TButton;
    NextInspector1: TNextInspector;
    NxToolbarItem1: TNxToolbarItem;
    NxTextItem7: TNxTextItem;
    NxTextItem8: TNxTextItem;
    NxTextItem9: TNxTextItem;
    NxSpinItem3: TNxSpinItem;
    NxToolbarItem2: TNxToolbarItem;
    NxToolbarItem3: TNxToolbarItem;
    NxTrackBarItem1: TNxTrackBarItem;
    NxCheckBoxItem1: TNxCheckBoxItem;
    NxMemoItem2: TNxMemoItem;
    NxToolbarItem4: TNxToolbarItem;
    NxRadioItem1: TNxRadioItem;
    NxRadioItem2: TNxRadioItem;
    NxToolbarItem5: TNxToolbarItem;
    NxColorItem2: TNxColorItem;
    NxDateItem1: TNxDateItem;
    NxComboBoxItem3: TNxComboBoxItem;
    NxTextItem10: TNxTextItem;
    NxFolderItem1: TNxFolderItem;
    NxProgressItem1: TNxProgressItem;
    procedure FormCreate(Sender: TObject);
    procedure NxComboBoxItem1Change(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure SpinEditor1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure NextInspector1ToolbarClick(Sender: TObject;
      Item: TNxPropertyItem; ButtonIndex: Integer);
    procedure NextInspector1Change(Sender: TObject; Item: TNxPropertyItem;
      Value: WideString);
    procedure Button4Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  NextInspector1.DoubleBuffered := True;
  NxComboBoxItem1.ItemIndex := 3;
  CheckBox1.Checked := NextInspector1.EnableVisualStyles;
  NxComboBoxItem1Change(Self);
end;

procedure TForm1.NxComboBoxItem1Change(Sender: TObject);
begin
  if NxComboBoxItem1.ItemIndex = 0 then
  begin
    NextInspector1.MarginColor := clBtnFace;
    NextInspector1.Style := psDefault
  end
  else if NxComboBoxItem1.ItemIndex = 1 then
  begin
    NextInspector1.MarginColor := clHighlight;
    NextInspector1.Style := psOffice2003
  end
  else if NxComboBoxItem1.ItemIndex = 2 then
  begin
    NextInspector1.MarginColor := clHighlight;
    NextInspector1.Style := psOffice2007
  end else if NxComboBoxItem1.ItemIndex = 3 then
  begin
    NextInspector1.MarginColor := clHighlight;
    NextInspector1.Style := psOffice2010;
  end else
  begin
    NextInspector1.MarginColor := clGrayText;
    NextInspector1.Style := psWhidbey;
  end;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  NextInspector1.EnableVisualStyles := CheckBox1.Checked;
end;

procedure TForm1.SpinEditor1Change(Sender: TObject);
begin
  NextInspector1.RowHeight := SpinEditor1.AsInteger;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  NxComboBoxItem1.ItemIndex := 3;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if Assigned(NextInspector1.SelectedItem) then
    NextInspector1.SelectedItem.AsInteger := 10;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  AItem: TNxPropertyItem;
begin
  AItem := NextInspector1.FindNextItem(NextInspector1.SelectedItem);
  if Assigned(AItem) then NextInspector1.SelectedItem := AItem else ShowMessage('No Item to Select');
end;

procedure TForm1.NextInspector1ToolbarClick(Sender: TObject;
  Item: TNxPropertyItem; ButtonIndex: Integer);
begin
  if Item.Count > 0 then
  begin
    with Item as TNxToolbarItem do
    begin
      ExpandLock := Buttons[ButtonIndex].Checked;
      if Buttons.Count = 3 then
        if ButtonIndex = 0 then Visible := False;
    end;
  end;  
end;

procedure TForm1.NextInspector1Change(Sender: TObject;
  Item: TNxPropertyItem; Value: WideString);
begin
  if Item = NxTrackBarItem1 then
  begin
    NxProgressItem1.Value := Item.Value;
  end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  if NextInspector1.ItemsArrange = taCatagory then
  begin
    TButton(Sender).Caption := 'By Category';
    NextInspector1.ItemsArrange := taName;
    CheckBox2.Enabled := False;
  end else
  begin
    TButton(Sender).Caption := 'By Name';
    NextInspector1.ItemsArrange := taCatagory;
    CheckBox2.Enabled := True;
  end;
end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  NextInspector1.HideTopLevel := TCheckBox(Sender).Checked;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  NextInspector1.SaveToXML('test.xml');
end;

end.
