summaryrefslogtreecommitdiff
path: root/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas')
-rw-r--r--plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas77
1 files changed, 77 insertions, 0 deletions
diff --git a/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas b/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas
new file mode 100644
index 0000000000..8e87d67d66
--- /dev/null
+++ b/plugins/Chess4Net/MI/TransmitGameSelectionUnit.pas
@@ -0,0 +1,77 @@
+unit TransmitGameSelectionUnit;
+
+interface
+
+uses
+ Forms, Controls, StdCtrls, TntStdCtrls, Classes,
+ //
+ ModalForm;
+
+type
+ TTransmitGameSelectionForm = class(TModalForm)
+ OkButton: TTntButton;
+ CancelButton: TTntButton;
+ TransmitGameListBox: TTntListBox;
+ procedure FormCreate(Sender: TObject);
+ private
+ procedure FLocalize;
+ protected
+ function GetModalID: TModalFormID; override;
+ public
+ procedure SetGames(Games: TStrings);
+ function GetSelected: TObject;
+ end;
+
+implementation
+
+{$R *.dfm}
+
+uses
+ LocalizerUnit;
+
+////////////////////////////////////////////////////////////////////////////////
+// TTransmitGameSelectionForm
+
+procedure TTransmitGameSelectionForm.FormCreate(Sender: TObject);
+begin
+ FLocalize;
+end;
+
+
+procedure TTransmitGameSelectionForm.FLocalize;
+begin
+ with TLocalizer.Instance do
+ begin
+ Caption := GetLabel(67);
+ OkButton.Caption := GetLabel(11);
+ CancelButton.Caption := GetLabel(12);
+ end;
+end;
+
+
+function TTransmitGameSelectionForm.GetModalID: TModalFormID;
+begin
+ Result := mfTransmitGame;
+end;
+
+
+procedure TTransmitGameSelectionForm.SetGames(Games: TStrings);
+begin
+ TransmitGameListBox.Items.Assign(Games);
+ if (TransmitGameListBox.Count > 0) then
+ TransmitGameListBox.ItemIndex := 0;
+end;
+
+
+function TTransmitGameSelectionForm.GetSelected: TObject;
+var
+ iIndex: integer;
+begin
+ iIndex := TransmitGameListBox.ItemIndex;
+ if (iIndex >= 0) then
+ Result := TransmitGameListBox.Items.Objects[iIndex]
+ else
+ Result := nil;
+end;
+
+end.