<code>

 

Description 

The code widget allows for displaying of pre-formatted text that is typically associated with source code. 

Optionally, a label can be included and is specified using a key to a lang file entry. Visibility bindings are also supported.

 

 

Examples

Example With a Label Excluded

View XML
<code>
    <visible function="showCodeSnippet"/>
    <binding variable="question">
        <attribute name="codeSnippet"/>
    </binding>
</code>
Backing unit
unit QuestionManagement;
Question question;

void initQuestion() {
    question = getCurrentQuestion();
}

bool showCodeSnippet() {
    if(question.codeSnippet == null) {
        return false;
    }
    return true;
}
.
.
.

Example With a Label Included

<code label="info.code_example">
    <visible function="showCodeSnippet"/>
    <binding variable="question">
        <attribute name="codeSnippet"/>
    </binding>
</code>
Backing unit
unit QuestionManagement;

Question question;

void initQuestion() {
    question = getCurrentQuestion();
}

bool showCodeSnippet() {
    if(question.codeSnippet == null) {
        return false;
    }
    return true;
}
.
.
.
en.lang file entries
info.code_example = Code example:

 

Additional Mentions and References