If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Until now I have always used a fixed wxString in my app that I hard-coded. I then split up the wxString into all the words and they are then shown in StaticTexts with ComboBoxes underneath.
Now I have tried to use a TexCtrl to let the user input some text which is then used to split the words and create the StaticTexts etc. But always when I write text that is longer than one line, there is a biiiiig space between two lines (FlexGridSizers) of text. I use:
Is it a single- or multiline text control? If the string contains line breaks (0x0a and/or 0x0d), you probably need to filter them out before processing them.
Actually I guess I tried both versions. One without the "multiline" option and one with it. I won't have to put a special option if I want a single line control, right? Why would the string contain a line break if there isn't even a line break in the TxtCtrl window while typing the text? At least I could see wrapping inside my wxMessageBox but maybe this happens independently. So there is no way of getting text input without these line breaks? It's no problem to filter them out but if there's another option...
I assumed they were line breaks, because that's the only reason i could think of to explain the behavior.
There shouldn't be any difference between a hardcoded string and one taken from a wxTextCtrl. Did you actually type the text, or copy-any-paste it from somewhere?
I typed it myself. Also converting the wxString to string won't change the behavior. Is there an option to print out the wxString somehow in a "raw" version? Like, so that I could see for example the line breaks? But I can just test filtering these out. If there are any and they are the culprit, I'll notice.
Wanderer82 wrote: ↑Thu Feb 02, 2023 9:08 pm
I typed it myself. Also converting the wxString to string won't change the behavior. Is there an option to print out the wxString somehow in a "raw" version? Like, so that I could see for example the line breaks? But I can just test filtering these out. If there are any and they are the culprit, I'll notice.
You could print the values of every character in the string:
I tried that but unfortunately I can't see a special character or a line break where the big space happens. It's just a normal space. This is very strange. And it's especially strange as in case I paste a long text (instead of typing it) into the TextCtrl, everything works fine, there are no big spaces.
Oh, now it's getting interesting. I found out that: the longer the text (the more lines), the smaller the space. And it doesn't matter if I paste the text or write it myself. So it might have something to do with my code as well. As I don't have time this week-end, this will have to wait a bit.