Slastraf Posted January 29, 2021 Share Posted January 29, 2021 Hey there, the following code example will make a text field which is rather big and can be applied to the example project if replaced by line 141 and following. auto styleTextArea = CreateTextField(border, border + 40, subpanel2->ClientSize().x - 2 * border, subpanel2->ClientSize().y - 2 * border - 40, subpanel2); styleTextArea->SetAlignment(1, 1, 1, 1); styleTextArea->SetText(" #my_iframe{\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n border:0;\n }\n\n #hide_button, #show_button{\n position: absolute;\n width: 100px;\n height: 30px;\n background-color: DodgerBlue;\n color: white;\n text-align: center;\n line-height: 30px;\n cursor: pointer;\n }\n\n #hide_button{\n left: 10px;\n }\n\n #show_button{\n left: 120px;\n }\n"); In the latter code example i put the whole text thing in one line , but using my original approach made it even buggier : #define MULTI_LINE_STRING(a) #a struct styleTextTemplate{ const char* text = MULTI_LINE_STRING( #my_iframe{\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n border:0;\n }\n\n #hide_button, #show_button{\n position: absolute;\n width: 100px;\n height: 30px;\n background-color: DodgerBlue;\n color: white;\n text-align: center;\n line-height: 30px;\n cursor: pointer;\n }\n\n #hide_button{\n left: 10px;\n }\n\n #show_button{\n left: 120px;\n }\n ); }; // and use setText auto styleTextArea = CreateTextField(border, border + 40, subpanel2->ClientSize().x - 2 * border, subpanel2->ClientSize().y - 2 * border - 40, subpanel2); styleTextArea->SetAlignment(1, 1, 1, 1); styleTextTemplate style; styleTextArea->SetText(style.text); EDIT: Sorry wrong category Link to comment Share on other sites More sharing options...
Slastraf Posted January 30, 2021 Author Share Posted January 30, 2021 bump Link to comment Share on other sites More sharing options...
Josh Posted January 31, 2021 Share Posted January 31, 2021 So you are just saying that adding a string with line returns causes it to display wrong? My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted January 31, 2021 Solution Share Posted January 31, 2021 I just updated the program. The TextField::SetText method will strip the \n and \r characters from the inputted text. My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts