mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-16 16:25:57 +01:00
d0838e2438
Added a certificate selection form to the MiniBrowser VCL demo
77 lines
1.7 KiB
ObjectPascal
77 lines
1.7 KiB
ObjectPascal
unit uSelectCertForm;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
|
|
Vcl.StdCtrls, Vcl.ExtCtrls;
|
|
|
|
type
|
|
TSelectCertForm = class(TForm)
|
|
ButtonPnl: TPanel;
|
|
SelectBtn: TButton;
|
|
CancelBtn: TButton;
|
|
CertificatesPnl: TPanel;
|
|
CertificatesLb: TListBox;
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
procedure SelectBtnClick(Sender: TObject);
|
|
procedure CancelBtnClick(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure CertificatesLbClick(Sender: TObject);
|
|
|
|
private
|
|
FCertificates : TStringList;
|
|
FSelected : integer;
|
|
|
|
public
|
|
property Certificates : TStringList read FCertificates;
|
|
property Selected : integer read FSelected;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TSelectCertForm.FormCreate(Sender: TObject);
|
|
begin
|
|
FCertificates := TStringList.Create;
|
|
FSelected := -1;
|
|
end;
|
|
|
|
procedure TSelectCertForm.CertificatesLbClick(Sender: TObject);
|
|
begin
|
|
SelectBtn.Enabled := (CertificatesLb.ItemIndex >= 0);
|
|
end;
|
|
|
|
procedure TSelectCertForm.FormDestroy(Sender: TObject);
|
|
begin
|
|
if assigned(FCertificates) then
|
|
FreeAndNil(FCertificates);
|
|
end;
|
|
|
|
procedure TSelectCertForm.FormShow(Sender: TObject);
|
|
begin
|
|
CertificatesLb.Items.Clear;
|
|
|
|
if assigned(FCertificates) and (FCertificates.Count > 0) then
|
|
CertificatesLb.Items.AddStrings(FCertificates);
|
|
end;
|
|
|
|
procedure TSelectCertForm.CancelBtnClick(Sender: TObject);
|
|
begin
|
|
FSelected := -1;
|
|
close;
|
|
end;
|
|
|
|
procedure TSelectCertForm.SelectBtnClick(Sender: TObject);
|
|
begin
|
|
FSelected := CertificatesLb.ItemIndex;
|
|
close;
|
|
end;
|
|
|
|
end.
|