ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
60.97k stars 10.29k forks source link

Support for Multiline Text Things starting scrolled at bottom #594

Closed ghost closed 8 years ago

ghost commented 8 years ago

Enhancement:
In a multi-line Text input, the option to have it automatically scroll to the base of the pane would be nice, or to allow it by function on callback. This will allow me to create a Console Like the Source Engine's.

ocornut commented 8 years ago

I don't know what "a console like the source engine's" one looks like. Why would you use a multi-line text input for a console? It sounds counter-intuitive to me. Have you looked at the Console example and could you clarify how it would differ?

ghost commented 8 years ago

Source is a 3D video game engine developed by Valve Corporation as the successor of GoldSrc. It debuted with Counter-Strike: Source in June 2004, followed shortly by Half-Life 2

http://bombas-home.de/wp-content/uploads/dods_connect.jpg

still, from the console, I want to be viewing the last printed lines, allowing them to scroll upwards to view previous commands, like a TTL console. I am unsure how it is unintuitive, BUT i'm not here to argue

ratchetfreak commented 8 years ago

I think you want an automatic scroll-to-bottom when a new line gets added (perhaps only if it was scrolled to the bottom already when the line was added).

ghost commented 8 years ago

Exactly what I meant @ratchetfreak

ocornut commented 8 years ago

The confusion is that you said "multi-line text input" when you meant "the output". They are different things since you aren't inputting text inside the zone that is scrolling, you are inputting text in a single-line input box.

What you are describing more or less what the existing Console example is doing. This is why I asked if you had looked at this example first.

You can't select individual lines of text (for clipboard copying) in that example, but you can copy the whole content into clipboard. If you are content with single color text-only non-interactive console and want precise selection, so can also replace the display by a read-only multiline text-input, if you Begin() inside the same child window you can call SetScrollPosHere() manually as a little hack to manipulate the scroll from the outside of the widget. But it'll be easier and have more advantage just going for what Console example is doing.

ocornut commented 8 years ago

TL:DR; check the Console example in the demo and let me know if there's something it doesn't do that you want.

ghost commented 8 years ago

I'm not sure where the examples in the source tree in all honesty, i saw the GL3 &c, but no console. Unless you meant the ones referenced in Readme.md

ocornut commented 8 years ago

In imgui_demo.cpp Function ImGui::ShowTestWindow() This is the function that is called by all the examples app. You can't really learn any imgui without this reference code so you've probably seen this demo :)

The Console demo is available from the menu bar.

ghost commented 8 years ago

ah! The menu bar

ghost commented 8 years ago

I feel like an idiot now /close

ocornut commented 8 years ago

No problems. If you feel there's something I could improve in the files/doc so I that you would have found it, let me know.