From 797e6dfabd234db3e452fabf5379f37f31dd5323 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Sat, 27 Aug 2011 21:04:29 +0000 Subject: [PATCH] fpchess: Recreates the button to start playing git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1844 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpchess/mainform.lfm | 23 ++++++++++++++++------- applications/fpchess/mainform.pas | 20 +++++++++++++++----- applications/fpchess/mod_fics.pas | 3 +-- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/applications/fpchess/mainform.lfm b/applications/fpchess/mainform.lfm index 59b485075..6e8c01d9b 100644 --- a/applications/fpchess/mainform.lfm +++ b/applications/fpchess/mainform.lfm @@ -14,7 +14,7 @@ object formChess: TformChess Height = 433 Top = 0 Width = 360 - PageIndex = 1 + PageIndex = 0 Align = alClient TabOrder = 0 TabStop = True @@ -59,12 +59,13 @@ object formChess: TformChess Caption = 'minutes for each player' ParentColor = False end - object BitBtn3: TBitBtn + object btnQuit: TBitBtn Left = 24 Height = 30 Top = 392 Width = 304 Caption = 'Quit' + OnClick = btnQuitClick TabOrder = 0 end object editPlayerName: TLabeledEdit @@ -130,7 +131,7 @@ object formChess: TformChess end object panelModules: TPanel Left = 8 - Height = 161 + Height = 121 Top = 224 Width = 344 BevelOuter = bvNone @@ -156,6 +157,15 @@ object formChess: TformChess ReadOnly = True TabOrder = 7 end + object btnStartGame: TBitBtn + Left = 24 + Height = 30 + Top = 352 + Width = 304 + Caption = 'Start game' + OnClick = btnStartGameClick + TabOrder = 8 + end end object pageGame: TPage ClientWidth = 360 @@ -193,8 +203,8 @@ object formChess: TformChess end end object pageWebservice: TPage - ClientWidth = 720 - ClientHeight = 866 + ClientWidth = 360 + ClientHeight = 433 object Label8: TLabel Left = 0 Height = 32 @@ -217,7 +227,7 @@ object formChess: TformChess EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideRight.Control = editPlayerName EditLabel.AnchorSideBottom.Control = editPlayerName - EditLabel.Left = -6462 + EditLabel.Left = -6822 EditLabel.Height = 17 EditLabel.Top = 75 EditLabel.Width = 79 @@ -233,7 +243,6 @@ object formChess: TformChess Top = 160 Width = 224 Caption = 'Start game' - OnClick = btnPlayAgainstAIClick TabOrder = 0 end object Label9: TLabel diff --git a/applications/fpchess/mainform.pas b/applications/fpchess/mainform.pas index e0302cea8..b12a344be 100644 --- a/applications/fpchess/mainform.pas +++ b/applications/fpchess/mainform.pas @@ -27,7 +27,8 @@ type { TformChess } TformChess = class(TForm) - BitBtn3: TBitBtn; + btnQuit: TBitBtn; + btnStartGame: TBitBtn; btnPlayAgainstAI: TButton; checkTimer: TCheckBox; comboGameMode: TComboBox; @@ -52,7 +53,8 @@ type spinPlayerTime: TSpinEdit; timerChessTimer: TTimer; pageWebservice: TPage; - procedure btnPlayAgainstAIClick(Sender: TObject); + procedure btnQuitClick(Sender: TObject); + procedure btnStartGameClick(Sender: TObject); procedure comboGameModeSelect(Sender: TObject); procedure FormCreate(Sender: TObject); procedure timerChessTimerTimer(Sender: TObject); @@ -171,14 +173,22 @@ begin end; end; -procedure TformChess.btnPlayAgainstAIClick(Sender: TObject); +procedure TformChess.btnQuitClick(Sender: TObject); +begin + Close; +end; + +procedure TformChess.btnStartGameClick(Sender: TObject); +var + lModule: TChessModule; begin InitializeGameModel(); notebookMain.PageIndex := INT_PAGE_GAME; -// if comboStartColor.ItemIndex = 0 then -// GetNextMoveFromBorlandWS(); + gSelectedModuleIndex := comboGameMode.ItemIndex; + lModule := GetChessModule(gSelectedModuleIndex); + lModule.PrepareForGame(); end; procedure TformChess.comboGameModeSelect(Sender: TObject); diff --git a/applications/fpchess/mod_fics.pas b/applications/fpchess/mod_fics.pas index e1db0095d..b4ec9769d 100644 --- a/applications/fpchess/mod_fics.pas +++ b/applications/fpchess/mod_fics.pas @@ -80,8 +80,7 @@ end; procedure TSinglePlayerChessModule.PrepareForGame; begin // SecondPlayerName := editSecondPlayerName.Text; - - + ChessModuleDebugLn('[TSinglePlayerChessModule.PrepareForGame]'); end; function TSinglePlayerChessModule.IsMovingAllowedNow: Boolean;