void TBEditField::OnFocusChanged(bool focused) { m_style_edit.Focus(focused); if (focused) { if (!m_style_edit.packed.multiline_on) { m_initial_edit_text.Clear(); GetText(m_initial_edit_text); } } else { if (!m_style_edit.packed.multiline_on) { TBStr curText; GetText(curText); if (!curText.Equals(m_initial_edit_text)) { TBWidgetEvent ev(EVENT_TYPE_CUSTOM); // TBIDC does not register the TBID with the UI system, so do it this way TBID refid("edit_complete"); ev.ref_id = refid; // forward to delegate TBWidget::OnEvent(ev); } } } TBWidget::OnFocusChanged(focused); }
void TBInlineSelect::OnWidgetFocusChanged(TBWidget *widget, bool focused) { if (widget == &m_editfield) { if (focused) m_editfield.GetText(m_initial_edit_value); else { TBStr editvalue; m_editfield.GetText(editvalue); if (m_modified || !editvalue.Equals(m_initial_edit_value.CStr())) { InvokeModifiedEvent(); } } } }