Static Text strings in wxwidgets Topic is solved

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.
Post Reply
marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Static Text strings in wxwidgets

Post by marcusbarnet » Sun Oct 20, 2019 11:20 am

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"
Last edited by marcusbarnet on Sun Oct 20, 2019 12:30 pm, edited 1 time in total.

Kvaz1r
Earned some good credits
Earned some good credits
Posts: 132
Joined: Tue Jun 07, 2016 1:07 pm

Re: Static Text strings in wxwidgets

Post by Kvaz1r » Sun Oct 20, 2019 11:27 am

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?

User avatar
doublemax
Moderator
Moderator
Posts: 14180
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Static Text strings in wxwidgets

Post by doublemax » Sun Oct 20, 2019 11:36 am

...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?
Use the source, Luke!

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Re: Static Text strings in wxwidgets

Post by marcusbarnet » Sun Oct 20, 2019 2:54 pm

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.
Attachments
gui.png

User avatar
doublemax
Moderator
Moderator
Posts: 14180
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Static Text strings in wxwidgets

Post by doublemax » Sun Oct 20, 2019 4:07 pm

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.
Use the source, Luke!

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Re: Static Text strings in wxwidgets

Post by marcusbarnet » Sun Oct 20, 2019 4:21 pm

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.

alys666
Super wx Problem Solver
Super wx Problem Solver
Posts: 274
Joined: Tue Oct 18, 2016 2:31 pm

Re: Static Text strings in wxwidgets

Post by alys666 » Sun Oct 20, 2019 7:28 pm

may be put static texts in vertical sizers?
at least they won't overlap so.
ubuntu 16.04, wxWidgets 3.0.4

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Re: Static Text strings in wxwidgets

Post by marcusbarnet » Sun Oct 20, 2019 7:52 pm

Yes I think it can help a little bit the visualization, thank you!

Post Reply