Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Read-Only Textbox with Scrollbar  (Read 4652 times)

0 Members and 1 Guest are viewing this topic.

bobmarley

  • Newbie
  • *
  • Posts: 3
    • View Profile
Read-Only Textbox with Scrollbar
« on: July 21, 2017, 05:06:32 am »
Is there a way to create a textbox in SFML?  I just need to write rows and rows of text and have the ability for the user to scroll through it.  It doesn't need to be editable.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Read-Only Textbox with Scrollbar
« Reply #1 on: July 21, 2017, 10:23:53 am »
Yes, but you need to write it yourself. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: Read-Only Textbox with Scrollbar
« Reply #2 on: July 21, 2017, 10:35:51 am »
Or use a gui library.
I don't know how well the other libraries support it, but TGUI has a TextBox that can be made read only. It only supports a vertical scrollbar.
TGUI: C++ SFML GUI

bobmarley

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Read-Only Textbox with Scrollbar
« Reply #3 on: July 22, 2017, 05:00:33 am »
Thanks all.

Well I did check out TGUI and I got it working.  I used TGUI .net.  Works great so far..  My only question is it still actively maintained?

I used TGUI from here https://tgui.eu/download/


Here is my code if anyone is curious.  Still got a bit of work to do.

Gui gui = new Gui(renderWindow);

TextBox textBox = new TextBox();
textBox.Position = new Vector2f(1400, 5);
textBox.Size = new Vector2f(200, 890);
textBox.Text = "blah blah\nblah\nblah";
gui.Add(textBox);

gui.Draw();


texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: Read-Only Textbox with Scrollbar
« Reply #4 on: July 22, 2017, 11:05:11 am »
Quote
is it still actively maintained?
More or less, it hasn't existed for a long time yet. There used to exist a TGUI.Net port for tgui 0.6 several years ago, but it was discontinued because I didn't have the time to keep it up to date with the big rewrites going on in the c++ version. Now that the api of tgui 0.8 is getting more stable, I created the current TGUI.Net binding.
It is only since last weekend that the builds have been automated so that any change I make to TGUI.Net is downloadable on the website within a few minutes. Before that, the last (and only) release that was made dated from February. I expect to be updating it more regularly now, to only keep it at most a few commits behind on the c++ version. And the more people using TGUI.Net, the more incentive I will also have to keep the .Net version up to date.
TGUI: C++ SFML GUI

bobmarley

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Read-Only Textbox with Scrollbar
« Reply #5 on: July 22, 2017, 03:42:06 pm »
Ah, you do all of that.  Well thanks for it, it certainly will save me some considerable time.

Well it sounds like it is being maintained if you are still building it and updating the forums.

The only thing I noticed with it was that Vector2f seems to have moved from SFML.Windows to SFML.System.  I assume this is just the base SFML has been refactored and that got pulled along with the TGUI dll's.  Just thought I'd mention it if someone else runs into it.

Thanks again!