Create a texte editor 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
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Create a texte editor

Post by gtafan »

So I am triing to write some kind of text editor with WxWdgets. I am puting a wxTextCtrl with multiline style into the boxsizer of the frame, there is no other components, but when I am resizing the frame the textCtrl is not really resizing.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Create a texte editor

Post by doublemax »

Please show the sizer related code.

Also: Depending on the capabilities you need, you should look into wxRichTextCtrl and wxStyledTextCtrl. The latter one is harder to use, because the official documentation is practically useless and you'll have to collect the necessary information from various other sources, e.g. some posts in this forum.
Use the source, Luke!
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Re: Create a texte editor

Post by gtafan »

doublemax wrote:Please show the sizer related code.

Also: Depending on the capabilities you need, you should look into wxRichTextCtrl and wxStyledTextCtrl. The latter one is harder to use, because the official documentation is practically useless and you'll have to collect the necessary information from various other sources, e.g. some posts in this forum.
wxRichTextCtrl is not worcking for me, as I am geting compiler error when using it. Just forgot to mention, that I am using wxSmith and CodeBlocks for my wxWidget projects.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Create a texte editor

Post by ONEEYEMAN »

Hi,
As doublemax' asked - can you post your code?

Also - it would be interesting to know what errors did you get for wxRichTextCtrl.

Thank you.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Create a texte editor

Post by eranon »

gtafan wrote:
doublemax wrote:Depending on the capabilities you need, you should look into wxRichTextCtrl and wxStyledTextCtrl.
wxRichTextCtrl is not worcking for me, as I am geting compiler error when using it. Just forgot to mention, that I am using wxSmith and CodeBlocks for my wxWidget projects.
I'm using CodeBlocks too and one of my apps using the wxRichTextCtrl control intensively has its user interface built from wxSmith. So, what's your difficulty with wxSmith, CodeBlocks and your underlying compiler against wxRichTextCtrl?

And as doublemax and ONEEYEMAN requested: your code, man :mrgreen:
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: Create a texte editor

Post by Nunki »

Hi gtafan,

Based on not seeing any code :-)

As for your first question, you need to set for the textcontrol the expand flag to horizontal alignment - providing the control is placed into a wxBoxSizerV. and also set the stretch factor=1. Only then your text control will fill up the entire space of the vertical box sizer and with resizing be capable in keeping up with the new size.

regards,
Nunki
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Re: Create a texte editor

Post by gtafan »

Nunki wrote:Hi gtafan,

Based on not seeing any code :-)

As for your first question, you need to set for the textcontrol the expand flag to horizontal alignment - providing the control is placed into a wxBoxSizerV. and also set the stretch factor=1. Only then your text control will fill up the entire space of the vertical box sizer and with resizing be capable in keeping up with the new size.

regards,
Nunki
Thanks, even I was able to find out myself the thing about expand flag, it´s really the solution. So my curent code looks like this:

Code: Select all

Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1"));
BoxSizer1->Add(TextCtrl1, 1, wxEXPAND, 0);
SetSizer(BoxSizer1);
Post Reply