Jump to content

Gwen and Multiline textboxes


Sfortune

Recommended Posts

I'm not sure if anyone here can help but I figured I would give it a go. I've been messing around with Lidgren/SFML/Gwen and have run into an issue with my multiline textbox used for chat. Whenever the message is sent there is no modification until it reaches the server. Than once it is there we get the players name added to it and a nice colon to separate the username from the message. Then it gets sent to all clients currently connected. Once is reaches a client I take what's in the old textbox and add the new message to the old and separate them with "\n" or Environment.NewLine (\r\n). I'm not sure whats going on but I get a little [] box instead of them added together with the new message on the next line. Ive included the packet that handles the data below and well as a screenshot. Any help would be much appreciated. Thanks all!

string msg = incMSG.ReadString();
string cMsg = svrGUI.outputChat.Text;
svrGUI.outputChat.SetText(cMsg + '\n' + msg);

post-77-14652851720515_thumb.png

Link to comment
Share on other sites

The [] is only because of the font you are using.  I had to switch fonts with Revamped because of this same issue.  You will have to either change the font or make a new line with the remaining text.

Link to comment
Share on other sites

I've tried about 6 fonts now, 3 different sizes for each as well but nothing. I've noticed that multiline textboxes don't really work that well in Gwen in the first place. Hopefully I can figure something out. Thanks for the help!

Link to comment
Share on other sites

I could never get Gwen to work, so all my text was actually being drawn to the screen at the coordinates.  Changing the font worked for what I was doing, but as far as Gwen goes it could be doing something different in the code that still inserts a [] when there is a line return char.

I believe Damian was able to bypass that issue and just create a new string to draw for each line of text.  It works too, so there may be a solution you could look into.  All of the word wrap stuff for that is on Revamped and Orion+ though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...