aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons
diff options
context:
space:
mode:
authorKonstantin Aladyshev <aladyshev22@gmail.com>2022-03-22 18:54:16 +0300
committerKonstantin Aladyshev <aladyshev22@gmail.com>2022-03-22 18:54:16 +0300
commit3b5a484c9b99f1b80bcb4398d43519b00a02fb6b (patch)
tree7299690acd9a44f86dd23e0cc41e7b7a91aa87ed /Lessons
parent0ed324e429c120a60f6345466b4d990fdda47df4 (diff)
downloadUEFI-Lessons-3b5a484c9b99f1b80bcb4398d43519b00a02fb6b.tar.gz
UEFI-Lessons-3b5a484c9b99f1b80bcb4398d43519b00a02fb6b.tar.bz2
UEFI-Lessons-3b5a484c9b99f1b80bcb4398d43519b00a02fb6b.zip
Add lesson 69
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons')
-rw-r--r--Lessons/Lesson_69/Before.pngbin0 -> 7874 bytes
-rw-r--r--Lessons/Lesson_69/DisableIf.pngbin0 -> 6312 bytes
-rw-r--r--Lessons/Lesson_69/GrayoutIf.pngbin0 -> 7565 bytes
-rw-r--r--Lessons/Lesson_69/InconsistentIf.pngbin0 -> 8041 bytes
-rw-r--r--Lessons/Lesson_69/NosubmitIf.pngbin0 -> 8514 bytes
-rw-r--r--Lessons/Lesson_69/README.md231
-rw-r--r--Lessons/Lesson_69/SuppressIf.pngbin0 -> 6320 bytes
-rw-r--r--Lessons/Lesson_69/SuppressIf_oneof1.pngbin0 -> 6788 bytes
-rw-r--r--Lessons/Lesson_69/SuppressIf_oneof2.pngbin0 -> 7291 bytes
-rw-r--r--Lessons/Lesson_69/WarningIf.pngbin0 -> 8013 bytes
-rw-r--r--Lessons/Lesson_69/WarningIf_timeout.pngbin0 -> 8196 bytes
11 files changed, 231 insertions, 0 deletions
diff --git a/Lessons/Lesson_69/Before.png b/Lessons/Lesson_69/Before.png
new file mode 100644
index 0000000..37520ca
--- /dev/null
+++ b/Lessons/Lesson_69/Before.png
Binary files differ
diff --git a/Lessons/Lesson_69/DisableIf.png b/Lessons/Lesson_69/DisableIf.png
new file mode 100644
index 0000000..ea60430
--- /dev/null
+++ b/Lessons/Lesson_69/DisableIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/GrayoutIf.png b/Lessons/Lesson_69/GrayoutIf.png
new file mode 100644
index 0000000..fa2a439
--- /dev/null
+++ b/Lessons/Lesson_69/GrayoutIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/InconsistentIf.png b/Lessons/Lesson_69/InconsistentIf.png
new file mode 100644
index 0000000..5803393
--- /dev/null
+++ b/Lessons/Lesson_69/InconsistentIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/NosubmitIf.png b/Lessons/Lesson_69/NosubmitIf.png
new file mode 100644
index 0000000..c4a17b8
--- /dev/null
+++ b/Lessons/Lesson_69/NosubmitIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/README.md b/Lessons/Lesson_69/README.md
new file mode 100644
index 0000000..8ad2719
--- /dev/null
+++ b/Lessons/Lesson_69/README.md
@@ -0,0 +1,231 @@
+In this lesson we will look at several built-in VFR conditionals.
+
+Before we go deep into this new keywords, let's look one more time at our form:
+
+![Before](Before.png?raw=true "Before")
+
+Remember it as a reference as we would change the look of our form in this lesson.
+
+Also each of the built-in`s in this lesson work with a conditional statement. But we want to show how the element works, so we would simply use a constant `TRUE` in the place of a conditional.
+
+# suppressif
+
+The suppress tag causes the nested objects to be hidden from the user if the expression appearing as the
+first nested object evaluates to TRUE.
+
+Opcode for this operation is:
+```
+#define EFI_IFR_SUPPRESS_IF_OP 0x0a
+```
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.7.3-vfr-statement-suppressif-definition
+
+As an example let's suppress our `orderedlist` element:
+```
+suppressif TRUE;
+ orderedlist
+ ...
+ endlist;
+endif;
+```
+
+After that the form would look like this:
+
+![SuppressIf](SuppressIf.png?raw=true "SuppressIf")
+
+One more use of `suppressif` is in the fact that you can hide options inside the question.
+
+For example currently our `oneof` question looks like:
+
+![SuppressIf_oneof1](SuppressIf_oneof1.png?raw=true "SuppressIf_oneof1")
+
+But adding `suppressif` like this:
+```
+oneof
+ varid = FormData.OneOfValue,
+ prompt = STRING_TOKEN(ONEOF_PROMPT),
+ help = STRING_TOKEN(ONEOF_HELP),
+ option text = STRING_TOKEN(ONEOF_OPTION1), value = 0x00, flags = 0;
+ option text = STRING_TOKEN(ONEOF_OPTION2), value = 0x33, flags = 0;
+ suppressif TRUE;
+ option text = STRING_TOKEN(ONEOF_OPTION3), value = 0x55, flags = 0;
+ endif;
+endoneof;
+```
+
+Would hide the option 3 for the user:
+
+![SuppressIf_oneof2](SuppressIf_oneof2.png?raw=true "SuppressIf_oneof2")
+
+# grayoutif
+
+All nested statements or questions will be grayed out (not selectable and visually distinct) if the expression appearing as the first nested object evaluates to TRUE.
+
+Opcode for this operation is:
+```
+#define EFI_IFR_GRAY_OUT_IF_OP 0x19
+```
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.7.4-vfr-statement-grayoutif-definition
+
+
+As an example let's grayout our `orderedlist` element:
+```
+grayoutif TRUE;
+ orderedlist
+ ...
+ endlist;
+endif;
+```
+
+As a result the element becomes unselectable like subtitle:
+
+![GrayoutIf](GrayoutIf.png?raw=true "GrayoutIf")
+
+# disableif
+
+All nested statements, questions, options or expressions will not be processed if the expression appearing as the first nested object evaluates to TRUE.
+
+Opcode for this operation is:
+```
+#define EFI_IFR_DISABLE_IF_OP 0x1E
+```
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.7.2-vfr-statement-disalbeif-definition
+
+As an example let's disable our `orderedlist` element:
+```
+disableif TRUE;
+ orderedlist
+ ...
+ endlist;
+endif
+```
+
+With this condition our form looks like in a `suppressif` example, the element is simply not present in the view:
+
+![DisableIf](DisableIf.png?raw=true "DisableIf")
+
+# warningif
+
+Creates a validation expression and warning message for a question.
+
+Opcode for this operation is:
+```
+#define EFI_IFR_WARNING_IF_OP 0x63
+```
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.6.1.7-vfr-question-tag-warningif-definition-vfrstatement
+
+
+This built-in is supposed to be used inside a question. Let's add it to the `orderedlist`:
+```
+orderedlist
+ varid = FormData.OrderedListValue,
+ prompt = STRING_TOKEN(ORDERED_LIST_PROMPT),
+ help = STRING_TOKEN(ORDERED_LIST_HELP),
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION1), value = 0x0A, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION2), value = 0x0B, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION3), value = 0x0C, flags = 0;
+ warningif
+ prompt = STRING_TOKEN(WARNING_IF_PROMPT),
+ TRUE
+ endif;
+endlist;
+```
+
+Add new string to the `UefiLessonsPkg/HIIFormDataElements/Strings.uni`
+```
+#string WARNING_IF_PROMPT #language en-US "WarningIf prompt"
+```
+
+The warning message appear when you change the variable and hit `enter`:
+
+![WarningIf](WarningIf.png?raw=true "WarningIf")
+
+But it is important to notice, that you can ignore the warning and still save the updated data with `F10`.
+
+With `warningif` it is possible to set timeout value for the warning message:
+```
+warningif
+ prompt = STRING_TOKEN(WARNING_IF_PROMPT),
+ timeout = 5,
+ TRUE
+endif;
+```
+
+In this case warning will dissapear after 5 seconds (or earlier if user presses a kay to acknowledge change). The ticking timer will be displayed on the popup window:
+
+![WarningIf_timeout](WarningIf_timeout.png?raw=true "WarningIf_timeout")
+
+# nosubmitif
+
+Creates a conditional expression which will be evaluated when the form is submitted. If the conditional evaluates to TRUE, then the error message Error will be displayed to the user and the user will be prevented from submitting the form.
+
+Opcode for this operation is:
+```
+#define EFI_IFR_NO_SUBMIT_IF_OP 0x10
+```
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.6.1.2-vfr-question-tag-nosubmitif-definition
+
+This built-in is supposed to be used inside a question. Let's add it to the `orderedlist`:
+```
+orderedlist
+ varid = FormData.OrderedListValue,
+ prompt = STRING_TOKEN(ORDERED_LIST_PROMPT),
+ help = STRING_TOKEN(ORDERED_LIST_HELP),
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION1), value = 0x0A, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION2), value = 0x0B, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION3), value = 0x0C, flags = 0;
+ nosubmitif
+ prompt = STRING_TOKEN(NOSUBMIT_IF_PROMPT),
+ TRUE
+ endif;
+endlist;
+```
+
+Add new string to the `UefiLessonsPkg/HIIFormDataElements/Strings.uni`
+```
+#string NOSUBMIT_IF_PROMPT #language en-US "NoSubmitIf prompt"
+```
+
+With this code you can still change the variable and hit `enter` and the form would display updated value with `Configuration changed` message. But the form submit (`F10`) would fail. It is not possible to save variable if `nosubmitif` condition evaluates to `TRUE`.
+
+![NosubmitIf](NosubmitIf.png?raw=true "NosubmitIf")
+
+# inconsistentif
+
+Creates a validation expression and error message for a question. The user should not be allowed to submit the results of a form inconsistency.
+
+VFR token definition can be found under a link https://edk2-docs.gitbook.io/edk-ii-vfr-specification/2_vfr_description_in_bnf/211_vfr_form_definition#2.11.6.1.1-vfr-question-tag-inconsistentif-definition
+
+Opcode for this operation is:
+```
+#define EFI_IFR_INCONSISTENT_IF_OP 0x011
+```
+
+This built-in is supposed to be used inside a question. Let's add it to the `orderedlist`:
+```
+orderedlist
+ varid = FormData.OrderedListValue,
+ prompt = STRING_TOKEN(ORDERED_LIST_PROMPT),
+ help = STRING_TOKEN(ORDERED_LIST_HELP),
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION1), value = 0x0A, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION2), value = 0x0B, flags = 0;
+ option text = STRING_TOKEN(ORDERED_LIST_OPTION3), value = 0x0C, flags = 0;
+ inconsistentif
+ prompt = STRING_TOKEN(INCONSISTENT_IF_PROMPT),
+ TRUE
+ endif;
+endlist;
+```
+
+Add new string to the `UefiLessonsPkg/HIIFormDataElements/Strings.uni`
+```
+#string INCONSISTENT_IF_PROMPT #language en-US "InconsistentIf prompt"
+```
+
+This code won't allow to change a variable to the value when `inconsistentif` evaluates to TRUE. Form will simply show popup message and won't change values.
+
+![InconsistentIf](InconsistentIf.png?raw=true "InconsistentIf")
diff --git a/Lessons/Lesson_69/SuppressIf.png b/Lessons/Lesson_69/SuppressIf.png
new file mode 100644
index 0000000..fe3614f
--- /dev/null
+++ b/Lessons/Lesson_69/SuppressIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/SuppressIf_oneof1.png b/Lessons/Lesson_69/SuppressIf_oneof1.png
new file mode 100644
index 0000000..5e4dc05
--- /dev/null
+++ b/Lessons/Lesson_69/SuppressIf_oneof1.png
Binary files differ
diff --git a/Lessons/Lesson_69/SuppressIf_oneof2.png b/Lessons/Lesson_69/SuppressIf_oneof2.png
new file mode 100644
index 0000000..21388d2
--- /dev/null
+++ b/Lessons/Lesson_69/SuppressIf_oneof2.png
Binary files differ
diff --git a/Lessons/Lesson_69/WarningIf.png b/Lessons/Lesson_69/WarningIf.png
new file mode 100644
index 0000000..14105ab
--- /dev/null
+++ b/Lessons/Lesson_69/WarningIf.png
Binary files differ
diff --git a/Lessons/Lesson_69/WarningIf_timeout.png b/Lessons/Lesson_69/WarningIf_timeout.png
new file mode 100644
index 0000000..2195954
--- /dev/null
+++ b/Lessons/Lesson_69/WarningIf_timeout.png
Binary files differ