MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ShowExampleAppWindowTitles

Function ShowExampleAppWindowTitles

lib/imgui/imgui_demo.cpp:4411–4434  ·  view source on GitHub ↗

Demonstrate using "##" and "###" in identifiers to manipulate ID generation. This apply to all regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for details.

Source from the content-addressed store, hash-verified

4409// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
4410// This apply to all regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for details.
4411static void ShowExampleAppWindowTitles(bool*)
4412{
4413 // By default, Windows are uniquely identified by their title.
4414 // You can use the "##" and "###" markers to manipulate the display/ID.
4415
4416 // Using "##" to display same title but have unique identifier.
4417 ImGui::SetNextWindowPos(ImVec2(100, 100), ImGuiCond_FirstUseEver);
4418 ImGui::Begin("Same title as another window##1");
4419 ImGui::Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique.");
4420 ImGui::End();
4421
4422 ImGui::SetNextWindowPos(ImVec2(100, 200), ImGuiCond_FirstUseEver);
4423 ImGui::Begin("Same title as another window##2");
4424 ImGui::Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique.");
4425 ImGui::End();
4426
4427 // Using "###" to display a changing title but keep a static identifier "AnimatedTitle"
4428 char buf[128];
4429 sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime() / 0.25f) & 3], ImGui::GetFrameCount());
4430 ImGui::SetNextWindowPos(ImVec2(100, 300), ImGuiCond_FirstUseEver);
4431 ImGui::Begin(buf);
4432 ImGui::Text("This window has a changing title.");
4433 ImGui::End();
4434}
4435
4436//-----------------------------------------------------------------------------
4437// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering()

Callers 1

ShowDemoWindowMethod · 0.85

Calls 1

ImVec2Class · 0.85

Tested by

no test coverage detected