Spawning a Child Window: Difference between revisions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
''Spawning a child window in SEM:'' | ''Spawning a child window in SEM:'' | ||
One window can be started from | 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 code to the (M) Pre-processing script of menu option in the ''parent'' window | ||
| Line 68: | Line 68: | ||
'''To Determine which Agents Should be Started in the Child Window...''' | '''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, if the same agents should be used by the child as are selected in the parent window, then the following code needs to be added to | The parent window can define which agents should be used when starting the child window. For example, if the same agents should be used by the child as are selected in the parent window, then the following code needs to be added to the parent: | ||
In the (M) Pre-processing script of the parent menu: | |||
# | # | ||
# Pass the server list to the child window via a temporary file | # Pass the server list to the child window via a temporary file | ||
# | # | ||
my | 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. | |||
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; | my @servers = map $SelectedEntry{$_}{"SV"}, sort keys %SelectedEntry; | ||
| Line 92: | Line 103: | ||
close(SVRS); | 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!)'' | |||
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. | |||
Revision as of 14:48, 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, if the same agents should be used by the child as are selected in the parent window, then the following code needs to be added to the parent:
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.
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!)
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.