void wxTextCtrl::DoSetValue(const wxString& value, int flags)
{
- if ( IsSingleLine() && (value == GetValue()) )
+ if ( value != GetValue() )
{
- // nothing changed
- return;
- }
+ EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
- Replace(0, GetLastPosition(), value);
+ Replace(0, GetLastPosition(), value);
- if ( IsSingleLine() )
+ if ( IsSingleLine() )
+ {
+ SetInsertionPoint(0);
+ }
+ }
+ else // nothing changed
{
- SetInsertionPoint(0);
+ // still send event for consistency
+ if ( flags & SetValue_SendEvent )
+ SendTextUpdatedEvent();
}
-
- if ( flags & SetValue_SendEvent )
- SendTextUpdatedEvent();
}
const wxArrayString& wxTextCtrl::GetLines() const
// now call it to do the rest (not related to refreshing)
ClearSelection();
+
+ if ( EventsAllowed() )
+ SendTextUpdatedEvent();
}
void wxTextCtrl::Remove(wxTextPos from, wxTextPos to)
{
// finding the last line is easy if each line has exactly
// one row
- yEnd = yStart + rectText.height / GetLineHeight() - 1;
+ yEnd = yStart + rectText.height / GetLineHeight();
}
if ( yEnd < y )
WData().m_rowFirstInvalid = 0;
// increase timestamp: this means that the lines which had been
- // laid out before will be relayd out the next time LayoutLines()
+ // laid out before will be relaid out the next time LayoutLines()
// is called because their timestamp will be smaller than the
// current one
WData().m_timestamp++;
{
case wxTE_HT_BEYOND:
// everything is visible
+ SData().m_ofsHorz = 0;
+
+ SData().m_colStart = 0;
SData().m_colLastVisible = text.length();
- // calc it below
+ // calculate it below
SData().m_posLastVisible = -1;
break;
fine for vertical scrolling as all lines have the same height but is rather
ugly for horizontal scrolling if proportional font is used. This is why we
manually update and use SData().m_ofsHorz which contains the length of the string
- which is hidden beyond the left borde. An important property of text
+ which is hidden beyond the left border. An important property of text
controls using this kind of scrolling is that an entire number of characters
is always shown and that parts of characters never appear on display -
neither in the leftmost nor rightmost positions.
// pos is the logical position to show
- // SData().m_ofsHorz is the fisrt logical position shown
+ // SData().m_ofsHorz is the first logical position shown
if ( pos < SData().m_ofsHorz )
{
// scroll backwards
if ( scrollRangeXOld )
{
- x *= scrollRangeX - m_rectText.width / charWidth;
- x /= scrollRangeXOld - m_rectText.width / charWidth;
+ const int w = m_rectText.width / charWidth;
+ if ( w != scrollRangeXOld )
+ {
+ x *= scrollRangeX - w;
+ x /= scrollRangeXOld - w;
+ }
Scroll(x, y);
}
// FIXME: is this really a bug in wxMSW?
rectTextArea.width--;
#endif // __WXMSW__
+ dc.DestroyClippingRegion();
dc.SetClippingRegion(rectTextArea);
// adjust for scrolling