wxTextCtrl and wxTE_RICH 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
stefania
Knows some wx things
Knows some wx things
Posts: 26
Joined: Wed Jul 20, 2005 9:08 am

wxTextCtrl and wxTE_RICH

Post by stefania » Fri Jan 30, 2015 8:14 am

Hi!
I need to set wxTE_RICH flag after the wxTextCtrl has created, but does not work fine.

wxTextAttr *l_attr = new wxTextAttr;
l_attr->SetFlags( wxTE_RICH);
l_attr->SetAlignment( wxTEXT_ALIGNMENT_RIGHT);
c_ptrtext->SetDefaultStyle( *l_attr);

Is there a way to set this flak dinamiccaly?

Thanks
Stefania

catalin
Moderator
Moderator
Posts: 1575
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: wxTextCtrl and wxTE_RICH

Post by catalin » Fri Jan 30, 2015 9:57 am

No.
In wxTextCtrl docs, at the end of 'Styles' section there is a note about the styles that can be changed dynamically after control creation (only wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT for wxMSW).

You can probably create a new control, copy the contents and replace the old one.

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

Re: wxTextCtrl and wxTE_RICH

Post by doublemax » Fri Jan 30, 2015 9:58 am

From the wxTextCtrl documentation:
Note that alignment styles (wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT) can be changed dynamically after control creation on wxMSW and wxGTK. wxTE_READONLY, wxTE_PASSWORD and wrapping styles can be dynamically changed under wxGTK but not wxMSW. The other styles can be only set during control creation.
Also: This is a window style flag. *If* it worked, you'd have to use wxWindow::SetWindowStyleFlag() to set it.
Use the source, Luke!

stefania
Knows some wx things
Knows some wx things
Posts: 26
Joined: Wed Jul 20, 2005 9:08 am

Re: wxTextCtrl and wxTE_RICH

Post by stefania » Fri Jan 30, 2015 10:12 am

Thanks.

Stefania

Post Reply