Page 1 of 1

Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 11:20 am
by marcusbarnet
Hi to all,

My applications (wxwidgets 3.1 and C++) usually use lots of static text strings to display messages to users. To do this, I create standard static texts and then I change their values with code and I hide() or show() them depending on user actions.

This works but it requires lots of static text controls and code. Moreover, the gui editor becomes pretty messy because I have several static texts overlapping.

Sometimes, I even need to split a full sentence in two static text strings because they doesn't fit in the screen.

Is there a more simple and professional method to display static text?

Thank you

P.s. FORUM PROBLEM: most times I can't submit a post because I get the message "the submitted form is invalid"

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 11:27 am
by Kvaz1r
Static text can contains several lines and you it's easy to update value without re-creating control, but can you provide a bit code for better understanding your issue?

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 11:36 am
by doublemax
...because I have several static texts overlapping.
In that case you should really have only one static text and set a different text based on the situation.

If you have lots of text to display, a read-only wxTextCtrl or wxHtmlWindow are really the only alternatives, but that depends on the actual situation. In most cases wxStaticTexts are the way to go to display static information. Can you show a screenshot of your app?

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 2:54 pm
by marcusbarnet
This is an example of the mess I have in each frame caused by the multiple text strings.

Most of them are set as hidden and then I show() them depending on the user input.
Other strings have default values and then I change them with values generated by the user.

I can't use the same string because the position (x,y) of each string is different and I need to display different periods in the same frame.

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 4:07 pm
by doublemax
Is that really only one page of the three? It looks more like all 3 pages put into one.

But if you have a background graphic and absolute positioned texts, there are no better alternatives.

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 4:21 pm
by marcusbarnet
yes, unfortunately, it's only one page; since there were lots of user interactions in my previous application, I wanted to avoid to create too many pages and so I tried to insert all the texts in a single page; the result was really a mess because it is hard to handle all the strings.

However, if it's the only way to do this, I will continue to handle the static texts with this method.

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 7:28 pm
by alys666
may be put static texts in vertical sizers?
at least they won't overlap so.

Re: Static Text strings in wxwidgets

Posted: Sun Oct 20, 2019 7:52 pm
by marcusbarnet
Yes I think it can help a little bit the visualization, thank you!