回复: [edk2-discuss] Conditional code execution in VFR


gaoliming
 

You can specify this question with INTERACTIVE flag, then handle write operation in Callback. If so, you don't depend on write.

-----邮件原件-----
发件人: discuss@edk2.groups.io <discuss@edk2.groups.io> 代表
Konstantin Aladyshev
发送时间: 2022年7月2日 0:12
收件人: discuss <discuss@edk2.groups.io>
主题: [edk2-discuss] Conditional code execution in VFR

Hello!

With the `write` keyword it is possible to set callback code for question set.
Is it possible to execute this callback only if some condition is satisfied?

I've tried to use `disableif` statement, but:
1) This doesn't do anything:
```
numeric
varid = FormData.NumericValue,
prompt = STRING_TOKEN(NUMERIC_PROMPT),
help = STRING_TOKEN(NUMERIC_HELP),
flags = NUMERIC_SIZE_2,
minimum = 0x0,
maximum = 0xffff,
step = 1,
disableif (get(FormData.CheckboxValue) == 1);
write
set(FormData.OneOfValue, 0x55);
endif;
endnumeric;
```
2) and this doesn't compile:
```
numeric
varid = FormData.NumericValue,
prompt = STRING_TOKEN(NUMERIC_PROMPT),
help = STRING_TOKEN(NUMERIC_HELP),
flags = NUMERIC_SIZE_2,
minimum = 0x0,
maximum = 0xffff,
step = 1,
disableif (get(FormData.CheckboxValue) == 1);
write
set(FormData.OneOfValue, 0x55);
endif;
endnumeric;
```

Best regards,
Konstantin Aladyshev