mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08:00
Updated Tips (markdown)
parent
9ff91ab851
commit
bca60ccea6
8
Tips.md
8
Tips.md
@ -13,8 +13,8 @@ They will help you understand how Dear ImGui works, and can help you diagnose pr
|
||||
|
||||
### Using Begin/BeginChild
|
||||
|
||||
- You can omit `Begin()`/`End()`, widgets will be created into an implicit "Debug" window.
|
||||
- You can call `Begin()` multiple times to append to a same window from different place.
|
||||
|
||||
- Use `Begin()`/`BeginChild()` to put yourself back into the context of another window (see [#270](https://github.com/ocornut/imgui/issues/270)
|
||||
An interesting trick that isn't obvious is that you can use Begin() just to put yourself into the context of that window. So here I want to react to the user inputting an address to scroll to, I use BeginChild() again on the child that I've already drawn so I can use SetScrollFromPosY() on it.
|
||||
|
||||
@ -29,6 +29,12 @@ ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (goto_addr / Rows) * lin
|
||||
ImGui::End();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Using ImGuiOnceUponAFrame
|
||||
|
||||
The `ImGuiOnceUponAFrame` helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle of a deep nested inner loop in your code. (It is essentially just a helper which stores and compare a frame number).
|
||||
|
||||
----
|
||||
|
||||
### Plot: Use Stride for easily plotting a field in array of structures
|
||||
|
Loading…
Reference in New Issue
Block a user