Spawning a Child Window: Difference between revisions

From Sysgem Support
Jump to navigationJump to search
No edit summary
No edit summary
Line 78: Line 78:
3.  The parent determines the list of agents to be used by the child and the child window opens with the startup window, but the agent button to change the agent is greyed out. This would be useful if the startup window has other input fields to be entered, but the agent list should not be changed.
3.  The parent determines the list of agents to be used by the child and the child window opens with the startup window, but the agent button to change the agent is greyed out. This would be useful if the startup window has other input fields to be entered, but the agent list should not be changed.


1. Automatically starting the child...
 
''1. Automatically starting the child...''


In the (M) Pre-processing script of the parent menu:
In the (M) Pre-processing script of the parent menu:
Line 98: Line 99:




2.  Starting the child display with suggested agents, and allowing the user to change the agent selection...
''2.  Starting the child display with suggested agents, and allowing the user to change the agent selection...''


Sometimes it is desirable simply to default the server list and allow the user to change the default settings before starting the display. To achieve this, script code needs to be added to both the parent menu (M) Pre-processing script and the child startup initialization script:
Sometimes it is desirable simply to default the server list and allow the user to change the default settings before starting the display. To achieve this, script code needs to be added to both the parent menu (M) Pre-processing script and the child startup initialization script:
Line 133: Line 134:




3. Starting the child display with suggested agents, but not allowing the user to change the agent selection...
''3. Starting the child display with suggested agents, but not allowing the user to change the agent selection...''


It is also possible to show the startup window, perhaps to allow the user to make an entry in a startup field, but not to allow the user to change the list of selected agents.
It is also possible to show the startup window, perhaps to allow the user to make an entry in a startup field, but not to allow the user to change the list of selected agents.

Revision as of 15:05, 29 March 2011

'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'.


Spawning a child window in SEM:

One window can be started from another window by:

  • adding code to the (M) Pre-processing script of menu option in the parent window
  • adding script comment in the Main Display Pre-processing script of the child window


To Initiate the Spawn Command from the Parent Window...

Add the following code in the '(M) Pre-processing script' of the menu option of the parent window:


   #
   #   start another display window, passing along information
   #   extracted from the selected entries.
   #
   #   @{{START_DISPLAY_SCRIPT
   
   #
   #   Don't display the menu dialog.
   #
   #   @{{MENU_OPTION_SILENT 
   #
   
   print "\@{{START_DISPLAY_TITLE Child Example\n";
   
   print "\@{{START_DISPLAY_NEW\n";
   
   print "\@{{START_DISPLAY_TILED\n";


To Identify the Child Window...

The following comment is added to the main 'Pre-processing' script to identify the display window as the one required. In the example below, the phrase "Child Example" is variable text to identify this particular window. The same text is used in the "\@{{START_DISPLAY_TITLE" output initiated by the (M) Pre-processing script in the menu option of the parent window.


   #
   #   @{{AUTOSTART_DISPLAY_TITLE Child Example
   #
   


To Pass Parameters from the Parent to the Child Window...

The following code added to the Parent menu option, in the (M) Pre-processing script, passes parameters to the child window using data from the selected entry in the parent window.

In this example, fields AA and AB of the selected entry in the parent window are sent to the child window:


   print "\@{{START_DISPLAY_PARAM AA $SelectedEntry{0}{AA}\n";
   print "\@{{START_DISPLAY_PARAM AB $SelectedEntry{0}{AB}\n";
   

This will cause the variables $INPUT_AA and $INPUT_AB to be defined in the Main Windows Agent script of the child window.

In UNIX agent scripts - access the Korn shell variables as ${INPUT_AA} and ${INPUT_AB}.

In VMS agent scripts - access the DCL logical names as INPUT_AA and INPUT_AB.


To Determine which Agents Should be Started in the Child Window...

The parent window can define which agents should be used when starting the child window. For example, the same agents are used by the child as are selected in entries on the parent window.

There are three different ways of achieving this:

1. The parent determines the list of agents to be used by the child and the child window starts without any further prompting.

2. The parent determines the list of agents to be used by the child and the child window opens with the startup window that allows the user to accept or change the list of agents to be connected.

3. The parent determines the list of agents to be used by the child and the child window opens with the startup window, but the agent button to change the agent is greyed out. This would be useful if the startup window has other input fields to be entered, but the agent list should not be changed.


1. Automatically starting the child...

In the (M) Pre-processing script of the parent menu:


   #
   #  Pass the server list to the child window via a temporary file
   #
   my @servers = map $SelectedEntry{$_}{"SV"}, sort keys %SelectedEntry;
   
   foreach my $server (@servers)
   {
       print "\@{{START_DISPLAY_SERVER $server\n";
   }


This will start the child window automatically and connect it to the selected servers.


2. Starting the child display with suggested agents, and allowing the user to change the agent selection...

Sometimes it is desirable simply to default the server list and allow the user to change the default settings before starting the display. To achieve this, script code needs to be added to both the parent menu (M) Pre-processing script and the child startup initialization script:

In the Parent (M) Pre-processing script:


   #
   #  Pass the server list to the child window 
   #
   my @servers = map $SelectedEntry{$_}{"SV"}, sort keys %SelectedEntry;
   
   open(SVRS, "> $FilePath") || die "Can't open $FilePath - $!\n";
   
   print SVRS join("\,", @servers) . "\n";
   
   close(SVRS);
   


... and in the startup initialize script of the child:


   #
   #  set up the connect to agent list
   #
   
   print "\@{{LOAD_SERVERS $VALUE_SV\n";    # to preselect the same servers as those selected in the parent window
   


(** Note: for this to work, the startup window needs to have an input field defined - even if only a field of type "-None-" with no text label!)


3. Starting the child display with suggested agents, but not allowing the user to change the agent selection...

It is also possible to show the startup window, perhaps to allow the user to make an entry in a startup field, but not to allow the user to change the list of selected agents.

To achieve this, the following script line should be added to the startup initialisation script after the print "\@{{LOAD_SERVERS command shown above.


   print "\@{{LOCK_SERVERS\n";              # to force these and only these to be used
   

By using the "LOCK_SERVERS" command - the startup window will be shown, but the Agents button will be greyed out.

(** Note: again, for this to work, the startup window needs to have an input field defined - even if only a field of type "-None-" with no text label!)