Tmemo and radiobuttons

I have a Tmemo that reads in a question at a time from a txt file,,,then in my Tmemo I got an RadioButtonGroup with 4 radiobuttons that acts like four question alternatives, how when the user clicks next question, how can you do so that the alternatives too change so they fits the alternatives to that question, and the next, and so on?? /




Thanks / Henrik

Comments

  • : I have a Tmemo that reads in a question at a time from a txt file,,,then in my Tmemo I got an RadioButtonGroup with 4 radiobuttons that acts like four question alternatives, how when the user clicks next question, how can you do so that the alternatives too change so they fits the alternatives to that question, and the next, and so on?? /
    :
    :
    :
    :
    : Thanks / Henrik
    :
    :
    Certainly. The radio buttons are in another TStrings object (= Items property). By adding another TStringList field to the form, and using the Items.CommaText, you can set the alternatives. "Next question" button example:
    [code]
    Memo1.Text := FQuestions[FCurrentQuestion];
    RadioGroup1.Items.CommaText := FAlternatives[FCurrentQuestion];
    [/code]
    where each line of the alternatives is structured like this (1 line as example):
    [code]
    FQuestion = What is your favorite food?
    FAlternatives = Italian,Chinese,Mexican,"San Marinoan"
    [/code]
    If an alterative contains commas or spaces, you need to enclose it in double quotes (also shown in the example).
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