{*******************************************************}
{                                                       }
{       RichView                                        }
{       Combo Item Demo                                 }
{                                                       }
{       Copyright (c) Sergey Tkachenko                  }
{       svt@trichview.com                               }
{       http://www.trichview.com                        }
{                                                       }
{*******************************************************}


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
  Dialogs, RVScroll, RichView, RVStyle, ComboItem, RVTable;

type
  TForm1 = class(TForm)
    RVStyle1: TRVStyle;
    rv: TRichView;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var item: TRVComboItemInfo;
    table: TRVTableItemInfo;
begin
  rv.AddNL('Virtual Greengrocery',0,1);
  rv.AddNL('',0,1);
  table := TRVTableItemInfo.CreateEx(2,2,rv.RVData);
  table.BorderColor := clSilver;
  table.BorderStyle := rvtbColor;
  table.BorderWidth := 2;

  table.Cells[0,0].Clear;
  table.Cells[1,0].Clear;
  table.Cells[0,1].Clear;
  table.Cells[1,1].Clear;
  table.Cells[0,0].AddNL('Select fruits:',0,0);
  table.Cells[1,0].AddNL('Select vegetables:',0,0);
  table.Cells[0,0].BestWidth := 200;
  table.Cells[0,1].BestWidth := 120;
  table.CellPadding := 5;
  table.ParaNo := 1;

  item := TRVComboItemInfo.CreateEx(rv.RVData, 1, '');
  item.MinWidth := 100;
  item.Items.Add('apple');
  item.Items.Add('banana');
  item.Items.Add('pear');
  table.Cells[0,1].AddItem('', item);

  item := TRVComboItemInfo.CreateEx(rv.RVData, 1, '');
  item.Items.Add('cucumber');
  item.Items.Add('tomato');
  item.MinWidth := 100;
  table.Cells[1,1].AddItem('', item);
  rv.AddItem('', table);
  rv.AddNL('(click the gray square to select)',0,1);
  rv.Format;

end;

end.
