wxRichTextCtrl: SetTabs

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
Radek
Super wx Problem Solver
Super wx Problem Solver
Posts: 286
Joined: Sun Sep 11, 2011 7:17 am

wxRichTextCtrl: SetTabs

Post by Radek » Mon Apr 01, 2013 5:04 pm

I need to create a simple table in a class derived from wxRichTextCtrl. I tried to ape the wxRichText example and wrote:

Code: Select all

wxTextAttrEx tattr;
wxArrayInt   tabs;
wxString     tabchr = wxString(static_cast<wxChar>(0x09),1);      // another attempt:  wxT("\t"); No improvement.

tabs.Clear();

tabs.Add(400);   // this is a test, the values are read from elsewhere
tabs.Add(800);   // but I am ignored anyway

tattr.SetFlags(wxTEXT_ATTR_TABS);
tattr.SetTabs(tabs);
SetDefaultStyle(tattr);

LineBreak();
WriteText(wxT("abc"));
writeText(tabchr);
WriteText(wxT("def"));
writeText(tabchr);
WriteText(wxT("ghi"));
but my tab stops are ignored. The tabs remain set the standard way. I also tried Newline() instead of LineBreak() but no avail. What am I doing wrong?

GTK, wxWidgets 2.8.12

Post Reply