I desperatly need help with an assignment :'(

Ok well i have to make a program based on 'Who wants to be a millionaire' in delphi using an array for the 15 questions fed in by a text file.
Problem is, i dont know how to use this- i was wanting to know how would i read in the first line of the text file into a label and then the next four lines into a readiogroup then reapeat the process 15 times?

also i was wanting to know how i can click on a button to bring up a count down timer (in the form of a dialog-box) and then close once its done.

if you know of how to do any of this, or can direct me to a site where i can read about it, that would be great.

thanks either way
from Jess

Comments

  • : Ok well i have to make a program based on 'Who wants to be a millionaire' in delphi using an array for the 15 questions fed in by a text file.
    : Problem is, i dont know how to use this- i was wanting to know how would i read in the first line of the text file into a label and then the next four lines into a readiogroup then reapeat the process 15 times?
    :
    : also i was wanting to know how i can click on a button to bring up a count down timer (in the form of a dialog-box) and then close once its done.
    :
    : if you know of how to do any of this, or can direct me to a site where i can read about it, that would be great.
    :
    : thanks either way
    : from Jess
    :
    I would suggest that you use an invisible TMemo to hold the questions. You cand use the TMemo.Lines.LoadFromFile() method to load the file. Then you have all the questions in an zero-indexed array, and can use assignments to fill the label and radiogroup.
    The countdown timer is best done using the TTimer. This TTimer should initially be disabled. In the OnClick of the button you enable the TTimer. The TTimer.OnTimer should decrease a counter. Once that counter reaches 0, disable the TTimer again.
    Bringing up a dialog box is quite simple. First you need to design a second TForm to create the dialog box itself. Then you need to add its unit-name to the uses list in the mainform's unit. Finally you can use the Show() or ShowModal() to show it and its Close() to close is. Here is an example of the mainform's unit:
    [code]
    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    ComCtrls[red], Unit2[/red];

    type
    TForm1 = class(TForm)
    // Left out form definition for space
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Form2.Show;
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
    Form2.Close;
    end;

    end.
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion