Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual scrolling and columns #543

Open
tambry opened this issue Mar 2, 2016 · 8 comments
Open

Virtual scrolling and columns #543

tambry opened this issue Mar 2, 2016 · 8 comments

Comments

@tambry
Copy link

tambry commented Mar 2, 2016

Hi!

So I'm just beginning to use ImGui to write a debugger for my N-Gage emulator project (NGEmu for short).
The first thing that I want to accomplish is displaying a big list, which would always point to the PC (program counter) and which would display if the line contains a breakpoint (red dot?), the memory address (up to 0x380000), the bytes at the memory address and the instruction name, if the memory location contains an instruction. It should also be able to group the bytes together depending on the instruction.
Adding such a huge number of elements every frame is obviously not possible. Is there a way to get the number of elements being displayed by the list and then have it add the needed elements?

An example posted in #123 for ProDBG seems to more or less showcase the structure for a disassembly window that I want.

@ocornut
Copy link
Owner

ocornut commented Mar 2, 2016

Hi Raul,

What you typically want here is to "seek" directly in the visible portion of the display. If you item heights are fixed this is trivial. Look at the ImGuiListClipper helper in imgui_demo.cpp and in issues https://github.com/ocornut/imgui/search?q=ImGuiListClipper&type=Issues&utf8=%E2%9C%93

If your item heights are variable this would be a little more work for you, you may need to create some adhoc data structure to help you identity the item number based on a Y position.

-Omar

@tambry
Copy link
Author

tambry commented Mar 3, 2016

Thank you very much for the advice, works like a charm!
I'm currently slightly confused by how to set the width of a column. PushItemWidth seems to have no effect on the column. Would you be able to... push me in the right direction?

@ocornut
Copy link
Owner

ocornut commented Mar 3, 2016

SetColumnOffset tho all the columns API is largely lacking (see the various threads about columns).

@ocornut ocornut closed this as completed Mar 3, 2016
@tambry
Copy link
Author

tambry commented Mar 3, 2016

Thank you very much. Seems like for now I don't have any problems with ImGui and I can continue with reverse-engineering.

@tambry tambry changed the title Big lists of columns Columns Mar 4, 2016
@tambry
Copy link
Author

tambry commented Mar 4, 2016

@ocornut Is there any easy way to make a whole column line selectable? Using ImGui::Selectable I can make a part of the line selectable, but I'd prefer to have the whole line clickable and selectable.

@ocornut
Copy link
Owner

ocornut commented Mar 4, 2016

Have you looked at the flags for Selectale() ?
Please look at the existing code and demo more carefully :)

@tambry
Copy link
Author

tambry commented Mar 4, 2016

Managed to not notice the usage in the demo. Thank you very much once again and I'll try to take a more through look the next time.

@tambry
Copy link
Author

tambry commented Mar 4, 2016

@ocornut Hi. Sorry again for bothering you once again.
This time I've got 3 issues.

  1. Is there any way to be able to have the scrolling "locked" locked in a way, that it only displays full lines, and the half-lines wouldn't appear? Half-line problem can be usually easily observed by clicking somewhere randomly on the scroll-bar.
  2. What would be the easiest/most reliable way to scroll to a certain line? I'm unable to use the approach, that's used in the demo, as I use the ImGuiListClipper for my huge list. ImGui::SetScrollFromPosY(line * ImGui::GetTextLineHeight())
    ^ Doesn't seem to quite centre the line.
  3. For some reason, the top-most line always only takes 1 click to add a breakpoint, while all others take 2 clicks.

The part where I use ImGui is available here: https://github.com/NGEmu/NGEmu/blob/master/NGEmu/Debugger/Debugger.cpp#L128

@ocornut ocornut reopened this Aug 20, 2017
@ocornut ocornut changed the title Columns Virtual scrolling and columns Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants