Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

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

Code Block
languagexml
titleView XML
linenumberstrue
<code>
    <visible function="showCodeSnippet"/>
    <binding variable="question">
        <attribute name="codeSnippet"/>
    </binding>
</code>
Code Block
languagejava
titleBacking unit
linenumberstrue
unit QuestionManagement;
Question question;

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

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

Example With a Label Included

Code Block
languagexml
linenumberstrue
<code label="info.code_example">
    <visible function="showCodeSnippet"/>
    <binding variable="question">
        <attribute name="codeSnippet"/>
    </binding>
</code>
Code Block
languagejava
titleBacking unit
linenumberstrue
unit QuestionManagement;

Question question;

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

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

 

Additional Mentions and References