Share via


Transitory Contexts

What are Transitory Contexts?

Transitory contexts are contexts managed by the TSF manager for applications that aren't TSF-Aware. They allow text services to operate in any application. However, there are substantial differences between Transitory contexts and normal contexts. The most significant difference is that Transitory contexts don't retain state - once you end the composition (or end the edit session, if you haven't started a composition), any knowledge of the document (or any previous insertions/modifications/etc.) is gone.

How can I tell that I'm in a transitory context?

Call ITfContext::GetStatus(), and if tfStatus.dwStaticFlags has the TF_SS_TRANSITORY bit set, you are in a transitory context.

What else is different about transitory contexts?

Other differences between transitory contexts and normal contexts is that there's exactly one transitory context; it gets re-attached to different windows as focus moves between controls.  This means that you get different notifications in a transitory context.  In particular, when the transitory context gets re-attached to a different window, the thread manager is not involved.  Therefore, you get an ITfTextLayoutSink::OnLayoutChange notification, not an ITfThreadMgrEventSink::OnFocusChange notification. 

Also, the ITfEditRecord interface passed to ITfTextEditSink::OnEndEdit only has valid data during a composition. (Calling the interface works, and all the methods succeed, they just return dummy data.)