📋 Metadata
- Author: roaoao
- Date: 2019-06-06 01:51:29
- Type:
answer - Reply to: post_02393
- Replies (1): post_02399
💬 Content
anminmakura:
This time I had a hard time because the condition specification was different from the previous one because I want to make a form that allows multiple selection of buttons.
Yes, in this case the code can be more complex. Instead of 0, 1, 2, ... indices items have 1 << 0, 1 << 1, 1 << 2, ... indices.
In getter you need to return bitwise OR of all selected items:
1 << 0 | 1 << 1 | 1 << 2 | ...
In setter you need to parse value:
value & 1 << 0 and print("0 item is selected"); value & 1 << 1 and print("1 item is selected"); value & 1 << 2 and print("2 item is selected"); ...
Here is an example.
LayersProperty allows to show/hide collections. You can find usages in LayersProperty Usage Examples popup.
❤️ 1 likes