Forum archive 2000-2006

Michael Gage - std_print_q -- plugin method used in type objects

Michael Gage - std_print_q -- plugin method used in type objects

by Arnold Pizer -
Number of replies: 0
inactiveTopicstd_print_q -- plugin method used in type objects topic started 8/28/2001; 1:30:36 AM
last post 8/28/2001; 1:30:36 AM
userMichael Gage - std_print_q -- plugin method used in type objects  blueArrow
8/28/2001; 1:30:36 AM (reads: 1770, responses: 0)

std_print_q -- plugin method used in "" type objects

This is a method ( i.e. a subroutine whose first argument is a reference to a parent object ) which defines how the list of questions is printed from a object.It formats a string containing the questions vertically in an ordered list, indexed by numbers with each question preceeded by an answer blank. The string is returned.


std_print_q( $self, @array)


$self is a reference to the parent list object and can be used to reference preferences stored there.
@array is the list of questions to be displayed.


A string, containing the questions, properly formatted.


$ml = new_match_list();
$ml->rf_print_a(~~&std_print_a); # set the answer format to use the std_print_a method
$ml->rf_print_q(~~&std_print_q); # set the question format to use the std_print_q method
$ml->ans_rule_len(20); # make the answer rules 20 characters long for each question. (Default is 4).
# enter three questions and their answers
$ml->qa( "What color is a rose?",
"What color is the sky?",
"What color is the sea?",
# choose two of these questions, ordered at random,
# which will be printed in the problem.
Match the answers below with these questions:$BR
\{$ml->print_q\} Print the questions$BR
\{$ml->print_a \} Print the answers


ANS( $ml->ra_correct_ans() ); #submit the correct answers


This method is defined in Note that reversing



would result in the list of questions being labeled with letters and the list of answers being labeled with numbers.
The code in these two methods is a good basis for writing subroutines which provide different formats for listing questions or answers.

See Also

std_print_a, pop_up_list_print_q,", "", "", ""


<| Post or View Comments |>