Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Text controller customization

Brew MP UI Widgets have a default text controller, but most device manufacturers need a customized controller to support different languages and predictive text. To achieve this custom functionality, device manufacturers need to override the default text controller with a custom text controller. This section covers customizing a text controller.

Customizing a text controller

When an application creates an instance of a text widget using ISHELL_CreateInstance, the text widget internally creates the instances of the default text controller, text model, and view model unless a device manufacturer has implemented a custom text controller. To do this, the text widget internally attempts to create an instance of OEMTextController. If a custom text controller was not provided, the text widget creates the default text controller using AEECLSID_CTextController.

Use the following steps to create a custom text controller.

  1. Implement the custom text controller as a static extension.
  2. Check that the text widget is creating an instance of the custom controller instead of a default controller. This can be achieved by setting a break point in the custom controller CreateInstance function.
  3. Add new modes to TextController, such as Predictive, Korean, Pinyin, or Strokes, depending on the design requirement.

    Every new mode can be implemented in a separate file with a separate handle event function, but this depends entirely on each manufacturer's design.

  4. After being received, words can be displayed in various scenarios as follows.
  5. In some scenarios, words are placed directly into the text widget. To handle this scenario, update the text model and the text model will then automatically trigger the call to the text widget for redraw.
  6. If the word needs to be placed in the widget, it is assumed that the widget is created at the controller initialization. To handle this scenario, insert the data in the model. With this approach, manufacturers can reuse the same widget for all the word combinations.
  7. After updating the widget's model, get the reference to the root container and insert the widget in the root container and it automatically appears on the screen.
  8. Move the focus to the widget for user selection.
  9. Once the item is selected, remove the pick list from the root container.
  10. Place the word in the text widget.