Reflection .NET API
Walkthrough / Add the Terminal User Control / Load Themes in the Terminal User Control
In This Topic
    Load Themes in the Terminal User Control
    In This Topic

    You can load themes in a Reflection Terminal User Control (TUC) at runtime. This can be useful when you want to indicate which TUC has focus on forms that have more than one TUC. This example uses the Reflection .NET API Theme object to dynamically load themes in IBM terminal user controls when the focus changes. 

     

    In this example, the TUC on the left has focus, as indicated by the theme with the black background.

    To indicate focus by loading themes into terminal user controls

    1. Open an IBM 3270 session in Reflection and click the Document Settings button on the Quick Access toolbar.
    2. In the Document Settings dialog box, select Manage Themes. Then in the Manage Themes dialog box, select Create New theme from an existing file.
    3. Select the theme to use as a template for the active theme and save it as active.themex.
    4. Repeat this process to create an inactive theme file. (In our example, we used the ice theme as a template and saved it in the inactive.themex file.)
    5. In a Visual Studio Windows form project, create the terminal access controls. In this example, we create two IBM controls as shown in Embed Terminal User Controls.
    6. In the Form Designer, select the first terminal user control and then, in the properties window, add an event handler for the Enter user control event.
    7.  

      Note: The Reflection  TUC support for Windows user control events is limited to the Focus events. To handle mouse, keyboard, or rendering events on the TUC, use the Reflection .NET API events.

    8. Set up an event handler for the Enter event on the other TUC in the same way.
    9. In Form1.cs, define the event handlers as follows:
    10. Indicate which Reflection terminal user control has focus
      Copy Code
      private string themePath = @"C:\Users\" + Environment.UserName + @"\Documents\Rocket\Reflection\Themes\";
      
      private void ibmTerminalControl1Focus(object sender, EventArgs e)
      {
          ibmTerminalControl1.IbmTerminal.Theme.Load(themePath + "active3270.themex");
          ibmTerminalControl2.IbmTerminal.Theme.Load(themePath + "inactive3270.themex");
      }
      
      private void ibmTerminalControl2Focus(object sender, EventArgs e)
      {
          ibmTerminalControl1.IbmTerminal.Theme.Load(themePath + "inactive3270.themex");
          ibmTerminalControl2.IbmTerminal.Theme.Load(themePath + "active3270.themex");
      }