I tried to set margins for wxTextCtrl using `wxTextCtrl::SetMargins` on macOS, but it never succeeds. I tried with margin value of 0 and 7, both didn't work. The code snippets I tested was below. Copy and paste it below Line 1258 in the samples/text/text.cpp. Also screenshots are attached. The first screenshot is setting margins to (7, 7), and (0, 0) the second one.
Code: Select all
int m = 0;
wxPoint ms = m_text->GetMargins();
wxLogMessage("expect %d, left %d, top %d", m, ms.x, ms.y);
The development environment is macOS (10.13.4) with wxWidgets 3.1.1.
BTW, to avoid the X-Y problem, what I am trying to do is to make a wxTextCtrl auto expand as more text is entered. Multi-line, no border. So I use `textCtrl->SetSize(dc.GetMultiLineTextExtent(text))` to do that. Is there a better way?
Any suggestion? Thanks!