diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2022-03-28 18:56:34 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2022-03-28 18:56:34 +0300 |
commit | 578a3fb3527d5b43ff4b5218208ef3880d4f73f2 (patch) | |
tree | 3c73219c6a70a2be9e873a11de2e8ad8ead45a55 /Lessons/Lesson_73 | |
parent | 428fd7220e9e0c7459c13e2246698489342c51dc (diff) | |
download | UEFI-Lessons-578a3fb3527d5b43ff4b5218208ef3880d4f73f2.tar.gz UEFI-Lessons-578a3fb3527d5b43ff4b5218208ef3880d4f73f2.tar.bz2 UEFI-Lessons-578a3fb3527d5b43ff4b5218208ef3880d4f73f2.zip |
Add info about default storages priority
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'Lessons/Lesson_73')
-rw-r--r-- | Lessons/Lesson_73/README.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Lessons/Lesson_73/README.md b/Lessons/Lesson_73/README.md index 567b8f0..dafeef5 100644 --- a/Lessons/Lesson_73/README.md +++ b/Lessons/Lesson_73/README.md @@ -488,3 +488,42 @@ QuestionId The question’s identifier, which must be unique within the form se Description: Push the value of the question specified by QuestionId on to the expression stack ``` + +# Default storages priority + +What will happen if we use `resetbutton` to change settings to the default storage with `ID=0x5555`, but some element only has `default` statements for the storages with different IDs (e.g. `ID=0x3333` and `ID=0x4444`). + +Here is some code to picture the situation: +``` +defaultstore FirstDefault, + prompt = STRING_TOKEN(FIRST_DEFAULT_PROMPT), + attribute = 0x3333; + +defaultstore SecondDefault, + prompt = STRING_TOKEN(SECOND_DEFAULT_PROMPT), + attribute = 0x4444; + +defaultstore ThirdDefault, + prompt = STRING_TOKEN(THIRD_DEFAULT_PROMPT), + attribute = 0x5555; + +numeric + varid = FormData.NumericValue, + prompt = STRING_TOKEN(NUMERIC_PROMPT), + help = STRING_TOKEN(NUMERIC_HELP), + minimum = 0, + maximum = 10, + default = 7, defaultstore = FirstDefault, + default = 8, defaultstore = SecondDefault, +endnumeric; + +resetbutton + defaultstore = TrirdDefault, + prompt = STRING_TOKEN(BTN_THIRD_DEFAULT_PROMPT), + help = STRING_TOKEN(BTN_THIRD_DEFAULT_HELP), +endresetbutton; +``` + +In this case `numeric` will get the value from the `defaultstore` with a lowest ID. In this case it is `FirstDefault` storage. So the element value would be set to `7`. + +This is a general rule that helps to simplify the code. For example if you want to support manufacturing defaults which are differ from standard defaults only for couple of elements, you need to write extra code only for these elements. |