Skip to content

Commit 56b859d

Browse files
authored
add user flags to dependencies docs
1 parent 8c1f0f3 commit 56b859d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mods/dependencies.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ $execute {
130130
}
131131
```
132132

133+
### User Flags
134+
135+
User flags are a frequently used alternative to user objects which does not store a value. This makes them a more optimized solution for our aforementioned scrollbar example.
136+
137+
```cpp
138+
layer->setUserFlag("hjfod.cool-scrollbars/enable");
139+
```
140+
141+
```cpp
142+
if (layer->getUserFlag("hjfod.cool-scrollbars/enable")) {
143+
// add scrollbar
144+
}
145+
```
146+
147+
Do note that user flags and user objects are separate - `getUserFlag` and `getUserObject` are not interchangeable and need to be consistent with the setter used.
148+
149+
Unlike user objects, user flags do not fire an event when set.
133150

134151
## Event Macro
135152

0 commit comments

Comments
 (0)