Elipse Knowledgebase



Employing GetScreen and ShowScreen methods.

Question:

How can I use the Viewer's GetScreen and the Frame's ShowScreen methods? What are they for?

Solution:

The GetScreen(ScreenName) method returns a Screen object, whose name must be set up at ScreenName parameter. This method's return value can be used at the Frame's ShowScreen method.

The ShowScreen(Screen, Zoom, Scrollbars[, Arg]) method loads a screen at the Frame, closing any screen or frame previously loaded on it. The Screen parameter only accepts objects returned by the Viewer's GetScreen method, and will fail if a screen object returned by another method or property is used.

To illustrate these methods' usefulness, imagine a situation where you need to open a screen and run a few scripts. Before these methods were developed, you needed a script to open the screen, and in this screen you needed another script (usually on OnPreShow event) to access its child objects.

The problem with this approach came when, for example, you needed to create libraries that depended on this script in the application, and which didn't allow developing a library that could reduce coupling issues. With GetScreen and ShowScreen methods, you can open the screen via scripts, and before the screen opens, you can retrieve the Screen object and access its desired child objects.

The attached demo application illustrates how to use an indexed windowed screen, which attributes the path of the XObject linked to the XControl directly to the script in the object's Click event, requiring no sending/receiving of the parameter on OnPreShow event.

Script employed in this example:

Sub Picture1_Click()

Arg = XCMotor.Source.PathName
Set newScreen = Application.GetFrame("virtualFrame")
newScreen.MoveFrame , , 250, 300
newScreen.SetFrameOptions XCMotor.Source.Name, 15+64+256+2048

Set screenObj = Application.GetScreen("CommandScreen")
newScreen.ShowScreen screenObj, 100, 0
screenObj.Item("IndexedScreen1").Source = Arg    

End Sub


NOTE: The attached demo application was developed with Elipse E3 version 4.8 239.


Related Articles

No related articles were found.

Attachments

Visitor Comments

No visitor comments posted. Post a comment

Post Comment for "Employing GetScreen and ShowScreen methods."

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.

   Name:
   Email:
* Comment:
* Enter the code below:

 

Article Details

Last Updated
23rd of May, 2017

Autor
Délio Damin

Would you like to...

Print this page  Print this page

Email this page  Email this page

Post a comment  Post a comment

 Subscribe me

Subscribe me  Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit


User Opinions

No users have voted.

How would you rate this answer?




Thank you for rating this answer.

Continue