nimterm/widgets/question
This page is generated from the module’s exported API and ## documentation comments.
Multiple-choice question with an optional free-text answer.
QuestionOption
Section titled “QuestionOption”QuestionOption = object label*: string description*: stringQuestionAnswer
Section titled “QuestionAnswer”QuestionAnswer = object selected*: int text*: string cancelled*: boolQuestionWidget
Section titled “QuestionWidget”QuestionWidget = ref object of Widget prompt*: string options*: seq[QuestionOption] selected*: int allowFreeText*: bool freeTextLabel*: string freeText*: InputWidget style*: Style selectedStyle*: Style descriptionStyle*: Style hintStyle*: StyleProcedures
Section titled “Procedures”newQuestion
Section titled “newQuestion”proc newQuestion(prompt: string; options: seq[QuestionOption]; style = defaultStyle(); selectedStyle = defaultStyle(); descriptionStyle = defaultStyle(); hintStyle = defaultStyle(); allowFreeText = true; freeTextLabel = "Other"): QuestionWidget {. raises: [], tags: [], forbids: [].}Returns: QuestionWidget.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
prompt |
string |
|
options |
seq[QuestionOption] |
|
style |
inferred |
defaultStyle() |
selectedStyle |
inferred |
defaultStyle() |
descriptionStyle |
inferred |
defaultStyle() |
hintStyle |
inferred |
defaultStyle() |
allowFreeText |
inferred |
true |
freeTextLabel |
inferred |
"Other" |
answer
Section titled “answer”proc answer(widget: QuestionWidget): EventResponse {.raises: [], tags: [], forbids: [].}Returns: EventResponse.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
cancel
Section titled “cancel”proc cancel(widget: QuestionWidget): EventResponse {.raises: [], tags: [], forbids: [].}Returns: EventResponse.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
Methods
Section titled “Methods”focusable
Section titled “focusable”method focusable(widget: QuestionWidget): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
method modal(widget: QuestionWidget): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
allowsBackgroundEvent
Section titled “allowsBackgroundEvent”method allowsBackgroundEvent(widget: QuestionWidget; event: UiEvent): bool {. raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
|
event |
UiEvent |
handle
Section titled “handle”method handle(widget: QuestionWidget; event: UiEvent): EventResponse {. raises: [], tags: [], forbids: [].}Returns: EventResponse.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
|
event |
UiEvent |
measure
Section titled “measure”method measure(widget: QuestionWidget; constraints: Constraints): Size {. raises: [], tags: [], forbids: [].}Returns: Size.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
|
constraints |
Constraints |
method paint(widget: QuestionWidget; canvas: var Canvas) {.raises: [Exception], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
QuestionWidget |
|
canvas |
var Canvas |