Multiple graphics scenario 2
- Last UpdatedJul 08, 2024
- 1 minute read
You want to open several graphics using the same interface element, such as a pushbutton. You also want to select the graphic position and the graphic name using interface elements, like combo boxes. You can configure a combo box on the Edit Animations page. The combo box values can be used as index values for the window location parameter. At run time, you can dynamically select the values for the window location using this combo box.
You can use the following script for the purpose:
dim popup as aaGraphic.GraphicInfo;
dim MyInt as Integer;
popup.GraphicName = SelectedSymbol.Value;
IF SelectedPosition.Value == 2 THEN
popup.Identity = "Top Left";
popup.WindowTitle = "Top Left Corner";
ENDIF;
IF SelectedPosition.Value == 4 THEN
popup.Identity = "TopRight";
popup.WindowTitle = "Top Right Corner";
ENDIF;
IF SelectedPosition.Value == 9 THEN
popup.Identity = "BottomLeft";
popup.WindowTitle = "Bottom Left Corner";
ENDIF;
IF SelectedPosition.Value == 11 THEN
popup.Identity "BottomRight";
popup.WindowTitle = "Bottom Right Corner";
ENDIF;
popup.RelativeTo = aaGraphic.RelativeTo.CustomizedWidthHeight;
popup.width = 300;
popup.height = 300;
MyInt = StringToIntg( SelectedPosition.Value );
popup.WindowLocation = MyInt;
ShowGraphic( popup );
In the script, popup.WindowLocation = MyInt substitutes the explicit reference with the integer index. SelectedSymbol is the combo box for dynamically selecting the graphic at run time and SelectedPosition is the combo box for dynamically selecting the window location.
At run time, click the ShowGraphic pushbutton to open all the graphics. You can select the graphic in the Select a graphic list. You can also select the location of the graphic in the Select a position list.