PageRenderTime 12ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/jcl/examples/windows/clr/ClrDemoStringsForm.pas

https://github.com/the-Arioch/jcl
Pascal | 54 lines | 41 code | 11 blank | 2 comment | 0 complexity | b13271102e4599e8f0c453b6e22c57eb MD5 | raw file
Possible License(s): BSD-3-Clause
 1unit ClrDemoStringsForm;
 2
 3interface
 4
 5uses
 6  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 7  StdCtrls, Buttons, ComCtrls, JclCLR;
 8
 9type
10  TfrmStrings = class(TForm)
11    lstStrings: TListView;
12    btnOK: TBitBtn;
13    procedure lstStringsData(Sender: TObject; Item: TListItem);
14  private
15    FStream: TJclCLRStringsStream;
16    procedure ShowStrings(const AStream: TJclCLRStringsStream);
17  public
18    class procedure Execute(const AStream: TJclCLRStringsStream);
19  end;
20
21implementation
22
23{$R *.DFM}
24
25uses
26  JclUnicode;
27
28{ TfrmStrings }
29
30class procedure TfrmStrings.Execute(const AStream: TJclCLRStringsStream);
31begin
32  with TfrmStrings.Create(nil) do
33  try
34    ShowStrings(AStream);
35    ShowModal;
36  finally
37    Free;
38  end;
39end;
40
41procedure TfrmStrings.ShowStrings(const AStream: TJclCLRStringsStream);
42begin
43  FStream := AStream;
44  lstStrings.Items.Count := FStream.StringCount;
45end;
46
47procedure TfrmStrings.lstStringsData(Sender: TObject; Item: TListItem);
48begin
49  Item.Caption := IntToStr(Item.Index);
50  Item.SubItems.Add(IntToHex(FStream.Offsets[Item.Index], 8));
51  Item.SubItems.Add(FStream.Strings[Item.Index]);
52end;
53
54end.