MultiSelect problem
Nitr0-G opened this issue · comments
Hi! Thank you so much for such a thing as ImGui and thank you so much for the large number of examples and various ready-made widgets/snippets!
Is multiselect of bytes support planned here? Something like this ocornut/imgui#1861
Hello,
I never thought of it in the context of the memory-editor, AFAIK multi-select imply stuff like deleting a selection, which imply offsetting and resizing the buffer, at that point we are leading toward a more full-featured hex editor.
Which multi-select feature in particular were you thinking about?
Hello, I never thought of it in the context of the memory-editor, AFAIK multi-select imply stuff like deleting a selection, which imply offsetting and resizing the buffer, at that point we are leading toward a more full-featured hex editor.
Which multi-select feature in particular were you thinking about?
Hi, I was thinking about multi-selections in the form of copying bytes and selecting them to convert, for example, to a string.
For example, as here:
I apologize for the long answer.
I started doing multiselection and first I made a function to calculate if I am in a cell. If I'm in cell, then next I look at mouse click and dragging.
bool IsMouseHoveringCurrentTableCell(float rowHeight)
{
ImVec2 cellMin = ImGui::GetCursorScreenPos();
ImVec2 cellMax = ImVec2(cellMin.x + ImGui::GetColumnWidth(), cellMin.y + rowHeight);
return ImGui::IsMouseHoveringRect(cellMin, cellMax);
}
static void HandleCellSelection()
{
if (ImGui::IsMouseDragging(ImGuiMouseButton_Left))
{
}
else if (ImGui::IsMouseClicked(ImGuiMouseButton_Left))
{
if (ImGui::GetIO().KeyShift)
{
}
else
{
}
}
}
void DrawContents(void* mem_data_void, size_t mem_size, size_t base_display_addr = 0x0000)
{
... code
if (IsMouseHoveringCurrentTableCell(17) && ImGui::IsWindowHovered())
{
HandleCellSelection();
}
... code
}
Omar, I need your little help. How can I draw a rectangle on top of the cell? Since such an implementation seems to work, but it doesn't seem to, since the rectangle itself simply does not exist.
auto drawList = ImGui::GetWindowDrawList();
// Draw background color
drawList->AddRectFilled(cellPos, { cellPos.x + cellSize.x, cellPos.y + cellSize.y }, backgroundColor);
// Draw selection frame as a square
ImU32 SelectionFrameColor = ImGui::GetColorU32(ImGuiCol_Text);
drawList->AddRect(cellPos, { cellPos.x + cellSize.x, cellPos.y + cellSize.y }, SelectionFrameColor, 0, ImDrawFlags_RoundCornersAll, 1);