type
TDemoForm =
class(TForm)
ActionPanel: TPanel;
StatusBar: TStatusBar;
Button: TButton;
ValueListEditor: TValueListEditor;
ComboBox: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ButtonClick(Sender: TObject);
procedure ComboBoxChange(Sender: TObject);
private
mif: TMemIniFile;
end;
var
DemoForm: TDemoForm;
implementation
{$R *.dfm}
uses
StrUtils;
procedure TDemoForm.FormCreate(Sender: TObject);
begin
mif := TMemIniFile.Create('
c:\daten\dp\creatures.ini');
end;
procedure TDemoForm.FormDestroy(Sender: TObject);
begin
mif.Free;
end;
function After(
const S, Pattern:
String):
String;
var
i: Integer;
begin
i := Pos(Pattern, S);
if i = 0
then Result := '
'
else Result := Copy(S, i + Length(Pattern), Length(S));
end;
procedure TDemoForm.ButtonClick(Sender: TObject);
var
s: TStrings;
i: Integer;
begin
with ComboBox
do
begin
mif.ReadSections(Items);
for i := 0
to Pred(Items.Count)
do
Items[i] := After(Items[i], '
creature ');
end;
end;
procedure TDemoForm.ComboBoxChange(Sender: TObject);
begin
mif.ReadSectionValues('
creature ' + ComboBox.Text,
ValueListEditor.Strings);
end;