-#if LEFT_MARGIN_CAN_BE_SET
- // Call SetMargins() on textctrl if LEFT_MARGIN_CAN_BE_SET == 1
- wxUnusedVar(textCtrlXAdjust);
- m_text->SetMargins(0);
- textCtrlXAdjust = 0;
-#endif
+ int x;
+
+ if ( !m_widthCustomPaint )
+ {
+ // No special custom paint area - we can use 0 left margin
+ // with wxTextCtrl.
+ if ( m_text->SetMargins(0) )
+ textCtrlXAdjust = 0;
+ x = m_tcArea.x + m_marginLeft + textCtrlXAdjust;
+ }
+ else
+ {
+ // There is special custom paint area - it is better to
+ // use some margin with the wxTextCtrl.
+ m_text->SetMargins(m_marginLeft);
+ x = m_tcArea.x + m_widthCustomPaint +
+ m_marginLeft + textCtrlXAdjust;
+ }