trichview.com

trichview.support




Re: Richview and adding a control (radiogroup)


Return to index


Author

Message

Yernar Shambayev

Posted: 06/10/2003 6:04:21


How do you add first radiogroup? Just put on a form? Then I see no relationship

between TRichView and TRadioGroup.


To add radiogroup control:


unit main;


interface


uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, RVStyle, RVScroll, RichView, ExtCtrls;


type

  TArnoldForm = class(TForm)

    RichView1: TRichView;

    RVStyle1: TRVStyle;

    Button1: TButton;

    Button2: TButton;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

  private

  public

  end;


var

  ArnoldForm: TArnoldForm;


implementation


{$R *.DFM}


procedure TArnoldForm.Button1Click(Sender: TObject);

var

  MyRadioGroup: TRadioGroup;

begin

  with RichView1 do

  begin

    Clear;

    AddNL('Example of adding a radiogroup.', 1, 1);

    AddNL('', 0, 0);

    MyRadioGroup := TRadioGroup.Create(nil);

    MyRadioGroup.Parent := ArnoldForm;

    MyRadioGroup.Items.Add('Terminator');

    MyRadioGroup.Items.Add('The Running Man');

    MyRadioGroup.Items.Add('The Predator');

    MyRadioGroup.ItemIndex := 1;

    AddControlEx('Arnold', MyRadioGroup, 1, rvvaBaseline);

    Format;

  end;

end;


procedure TArnoldForm.Button2Click(Sender: TObject);

var

  //  ItemNo: Integer;

  AName: string;

  ACtrl: TControl;

  AVAlign: TRVVAlign;

  ATag: Integer;

  MyIndex: Integer;

begin

  RichView1.GetControlInfo(2, AName, ACtrl, AVAlign, ATag);

  MyIndex := (ACtrl as TRadioGroup).ItemIndex;

  Label1.Caption := IntToStr(MyIndex);

  Label2.Caption := AName;

  Label3.Caption := (ACtrl as TRadioGroup).Items[MyIndex];

end;


end.





Powered by ABC Amber Outlook Express Converter