WxSizers and update 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
cali1981
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Jul 21, 2006 2:23 pm
Contact:

WxSizers and update

Post by cali1981 » Fri Feb 23, 2007 10:47 am

Hi all!
I'm developing an pplication with wxWidgets. I use sizers, wxStaticBoxSizer, and I add static texts inside it. The problem is I don't know hoe many lines I should add! When I receive a packet from the web I know how many lines should I add. Can I update the sizer's size to accomodate all the lines I need? How can I do it?
Ad advice: will this be a problem for the GUI? I mean, when the program receives the packet, it automaticcaly resize the main window, could this be a problem for the user?

Thank you

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan » Fri Feb 23, 2007 1:10 pm

Hi,
may be easier to use wxTextCtrl with multiline and readonly style instead wxStaticText?
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

cali1981
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Jul 21, 2006 2:23 pm
Contact:

Post by cali1981 » Fri Feb 23, 2007 1:55 pm

Which is the difference between them?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Fri Feb 23, 2007 11:08 pm

cali1981 wrote:Which is the difference between them?
wxTextCtrl is a text area - just like the one you typed in when typing this reply. Making a non-editable text area can indeed be easier for just displaying a bunch of text

The advantage is that lines will automatically warp, whereas with staticText you would need to do it manually

framepointer
Super wx Problem Solver
Super wx Problem Solver
Posts: 264
Joined: Mon Aug 07, 2006 3:25 pm
Location: Baia Mare, Romania
Contact:

Post by framepointer » Mon Feb 26, 2007 6:49 pm

The main diffrence is that you create a control for a text, adding alot of overhead for a simple task of displaying text data.

You coudl use wxListCtrl instead on wxTextXtrl/statictext. Whenever you get data you add a new list item.

Or if the data you receive is logically linked (eg a html source, chat messages, etc) you can use wxTextCtrl.

But of what I understand wxListCtrl with no column would fit you best. Just use a wxListCtrl in report mode, 1 single column, with labelEdit off, and set the column to autosize : Setcolumnwidth(col_num, -1);


Regards
Software is like sex,
It's better when it's free.
~Linus Torvalds

framepointer
Super wx Problem Solver
Super wx Problem Solver
Posts: 264
Joined: Mon Aug 07, 2006 3:25 pm
Location: Baia Mare, Romania
Contact:

Post by framepointer » Mon Feb 26, 2007 6:52 pm

The main diffrence is that you create a control for a text, adding alot of overhead for a simple task of displaying text data.

You coudl use wxListCtrl instead on wxTextXtrl/statictext. Whenever you get data you add a new list item.

Or if the data you receive is logically linked (eg a html source, chat messages, etc) you can use wxTextCtrl.

But of what I understand wxListCtrl with no column would fit you best. Just use a wxListCtrl in report mode, 1 single column, with labelEdit off, and set the column to autosize : Setcolumnwidth(col_num, -1);

PS: if you stick to the statictext stuff, i suggets you use wxScrolledWindow as parent and call sizr->Layout() after adding something, or else ... the content will update on the next internal idle event or something (or so it they say) or when you resize the window.

Regards
Software is like sex,
It's better when it's free.
~Linus Torvalds

Post Reply