// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
// However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
// However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max) followed by an empty Text("") statement.
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
ImVec2canvas_pos=ImGui::GetCursorScreenPos();// ImDrawList API uses screen coordinates!
ImVec2canvas_pos=ImGui::GetCursorScreenPos();// ImDrawList API uses screen coordinates!
ImVec2canvas_size=ImVec2(ImMax(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x),ImMax(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y));// Resize canvas what's available
ImVec2canvas_size=ImVec2(ImMax(50.0f,ImGui::GetWindowContentRegionMax().x-ImGui::GetCursorPos().x),ImMax(50.0f,ImGui::GetWindowContentRegionMax().y-ImGui::GetCursorPos().y));// Resize canvas what's available
if(ImGui::SmallButton("Add Dummy Text"))AddLog("some text\nsome more text\ndisplay very important message here!\n");ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Text")){AddLog("%d some text",Items.size());AddLog("some more text");AddLog("display very important message here!");}ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Error"))AddLog("[error] something went wrong");ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Error"))AddLog("[error] something went wrong");ImGui::SameLine();
if(ImGui::SmallButton("Clear"))ClearLog();
if(ImGui::SmallButton("Clear"))ClearLog();
ImGui::Separator();
ImGui::Separator();
@ -8550,8 +8553,8 @@ struct ExampleAppConsole
ImGui::Separator();
ImGui::Separator();
// Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end());
// Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end());
// NB- if you have lots of text this approach may be too inefficient. You can seek and display only the lines that are on display using a technique similar to what TextUnformatted() does,
// NB- if you have thousands of entries this approach may be too inefficient. You can seek and display only the lines that are visible - CalcListClipping() is a helper to compute this information.
// or faster if your entries are already stored into a table.
// If your items are of variable size you may want to implement code similar to what CalcListClipping() does. Or split your data into fixed height items to allow random-seeking into your list.