You can dynamically show or hide controls on the user interface to provide a customized user experience. You can also enable or disable controls and change the actions that are mapped to controls.
You can manipulate any control that is configured with the UI Designer. InfoConnect does not provide programmatic access to other controls.
This walkthrough shows how to:
Add a Custom Control in the UI Designer
Before you open Visual Studio, you'll need to add the custom controls you want to access in the InfoConnect UI Designer.
Open the InfoConnect workspace and create a demo session as follows:
If you are using IBM, create an IBM3270 session with a host name of "demo:ibm3270.sim" and save the session as demoSession.rd3x in the default folder (...\myDocuments\Micro Focus\InfoConnect.)
If you are using Open Systems, create a VT session with a host name of "demo:UNIX" and save the session as demoSession.rdox in the default folder.
This sample shows how to dynamically display a tab on a session that you have configured previously in the UI Designer.
Attachmate.Reflection
Attachmate.Reflection.Framework
Attachmate.Reflection.Emulation.IbmHosts
You can dynamically add or change the action mapped to a button. This sample changes the action of the button you configured above from opening a URL to sending a string of data to the host.
Add the following code to the bottom of the event handler that you set up earlier (in Display a Control). This code creates an action and adds it to an Input action sequence. Then it gets the button with its control ID and maps the action sequence to the button.
Map an action to a button |
Copy Code
|
---|---|
static void screen_NewScreenReady(object sender, EventArgs e) { ..................................................................... controlTab.Visible = true; //Create an object array that contains data and an action to send it to the host //Then create an action sequence and add the action to it object[] param = { "data" }; InputMapAction action = new InputMapAction(InputMapActionID.SendHostTextAction, param); InputMapActionSequence actionSequence = new InputMapActionSequence(); actionSequence.Add(action); //Get the button control with its control ID and bind the action sequence to the button IUiControl controlButton = (IUiControl)ui.GetControlById(ctrlID_button); screen.Parent.UiControlActionMapper.Add(controlButton, actionSequence); } } |