Jump to content

m_pell_98037

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by m_pell_98037

  1. m_pell_98037

    If Then dilema

    Compiles, but program has bugs. I'm sure it's the if's. Perhaps I should use subs. HLP Please. procedure TDialogs3Form.Image52Click(Sender: TObject); var B: TBitmap; i: Integer; begin i := 0; Current_Card := Image52.Tag; // Tag number provides index number into btn array below to get card name. Tries := StrToInt(Clicks.Text) + 1; // Keep score Clicks.Text := IntToStr(tries); B := TBitMap.Create; Imagelist1.GetBitmap(Current_Card, B); Image52.Picture.Bitmap.Assign(B); B.Free; inc(Card_Selected); if (Card_Selected = 1) then First_Card_Tag := Current_Card; First_Card_Image := TImage(Components); Card1_Selected_Name := Btn[Current_Card].Text ; Edit4.Text := Card1_Selected_Name; Label53.Caption := 'Pick Another Card'; if Card_Selected = 2 then Card2_Selected_Name := Btn[Current_Card].Text ; Edit4.Text := Card1_Selected_Name; Edit1.Text := Card2_Selected_Name; Sleep( 5000 ); Card_Selected := 0; if Card1_Selected_Name = Card2_Selected_Name then Edit4.Text := ''; Edit1.Text := ''; Label53.Caption := ' Match'; Image52.Visible := False; // Make 2nd Card invisble First_Card_Image.Visible := False; // Make 1st Card invisble if Card1_Selected_Name <> Card2_Selected_Name then Edit4.Text := ''; Edit1.Text := ''; Label53.Caption := 'Select 1st Card'; B := TBitMap.Create; Imagelist1.GetBitmap(0, B); // Card back Image52.Picture.Bitmap.Assign(B); B := TBitMap.Create; Imagelist1.GetBitmap(0, B); // Card back First_Card_Image.Picture.Bitmap.Assign(B); B.Free; end;
  2. m_pell_98037

    If Then dilema

    Help from the community was indispensable. I didn't just read posts, I tried them. Which got me down the path. You know I just have to replace broken code with something that works perfectly. procedure TDialogs3Form.Image52Click(Sender: TObject); var B: TBitmap; i: Integer; begin i := 0; Current_Card := Image52.Tag; // Tag number provides index number into btn array below to get card name. Tries := StrToInt(Clicks.Text) + 1; // Keep score Clicks.Text := IntToStr(tries); B := TBitMap.Create; Imagelist1.GetBitmap(Current_Card, B); Image52.Picture.Bitmap.Assign(B); B.Free; inc(Card_Selected); if (Card_Selected = 1) then begin First_Card_Tag := Current_Card; Card1_Selected_Name := Btn[Current_Card].Text ; nr := (Sender as TImage).Name; // nr : string; First_Card_Image := (Dialogs3Form.Findcomponent(nr) as TImage); // Saving the 1st of two Image clicks. Label53.Caption := 'Pick Another Card'; end else if Card_Selected = 2 then begin Card2_Selected_Name := Btn[Current_Card].Text ; Label53.Caption := '2nd Card'; ShowTime; //=ShowMessage // Call this Dialog procedure to break out of Image10Click procedure, so card face displays. end; //(otherwise 2nd card face won't display at all), and you can look at the pair of cards as long Message dialog is up. if Card_Selected = 2 then if Card1_Selected_Name = Card2_Selected_Name then begin Label53.Caption := ' Match'; // Msg to player Image52.Visible := False; // Make 2nd Card invisble First_Card_Image.Visible := False; // Make 1st Card invisble Card_Selected := 0; end; if Card_Selected = 2 then if Card1_Selected_Name <> Card2_Selected_Name then begin Label53.Caption := 'Select 1st Card'; // Msg to player B := TBitMap.Create; Imagelist1.GetBitmap(0, B); // Display card backside Image52.Picture.Bitmap.Assign(B); Imagelist1.GetBitmap(0, B); // Display card backside First_Card_Image.Picture.Bitmap.Assign(B); B.Free; Card_Selected := 0; end; end; Thanks again for the community help
  3. m_pell_98037

    If Then dilema

    I concur. Just thought I'd throw it out there. Sounds like you've tried this, so I saved your post (as well as others) in project folder. I'll glean something from it later, if you don't mind and its there so i did. Thanks again Michael Pell -> Knowledge is to be shared. imho
  4. m_pell_98037

    If Then dilema

    It is going to be Solitaire Concentration game. The Try Finally compiled as did K's end else if then begin, suggestion. I'm ready to start stepping into program. Drat! I usually start out the long hard way to get something running and then refine. Sometimes I get bit when chunks are to big. Still knocking out cobb webs since Delphi 2. I sure appreciate the help. At least now things compile. I thought there was a way to bundle a whole project for export. Did that go away. Might be easier if you see whole ball of wax. Thanks Michael Pell
×