0
我試圖做一個組合框,選擇第一個項目後更改。我的操作系統是Ubuntu 12.04。我的代碼:Lazarus - SelectFirst給出錯誤
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, Menus;
type
{ TForm1 }
TForm1 = class(TForm)
ComboBox1: TComboBox;
Edit1: TEdit;
Label1: TLabel;
Memo1: TMemo;
procedure ComboBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.ComboBox1Change(Sender: TObject);
var Text2:String;
begin
if (Combobox1.ItemIndex = 1) Then
begin
Text2 := Memo1.SelText;
Edit1.Text := Memo1.SelText;
Memo1.SelText := '[artist]' + Text2 + '[/artist]';
end;
if (Combobox1.ItemIndex = 2) Then
begin
if (Edit1.Text = '') Then
ShowMessage('Artist name is not defined') Else
begin
Text2 := Memo1.SelText;
Memo1.SelText := '[album artist=' + Edit1.Text + ']' + Text2 + '[/album]';
end;
end;
if (ComboBox1.ItemIndex = 3) Then
begin
if (Edit1.Text = '') Then
ShowMessage('Artist name is not defined') Else
begin
Text2 := Memo1.SelText;
Memo1.SelText := '[track artist=' + Edit1.Text + ']' + Text2 + '[/track]'
end;
end;
if (ComboBox1.ItemIndex = 4) Then
begin
Text2 := Memo1.SelText;
Memo1.SelText := '[label]' + Text2 + '[/label]';
end;
if (ComboBox1.ItemIndex = 5) Then
begin
Text2 := Memo1.SelText;
Memo1.SelText := '[tag]' + Text2 + '[/tag]';
end;
Combobox1.SelectFirst;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Text := 'Select an item';
end;
end.
這給出了一個錯誤:unit1.pas(74,13)錯誤:標識符idents沒有成員 「SelectFirst」
我怎樣才能解決這個問題?