Selection Property Example

Returning an Area object from a user's selection, the example displays the coordinates of the object, referred to as MyArea.

Sub Main()

 Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object

 

 Set Sys = CreateObject("EXTRA.System")

' Assumes an open session

 Set Sess = Sys.ActiveSession

 Set MyScreen = Sess.Screen

 

 ' This will return the coordinates of the area selected in the
 ' current session. Note, that if nothing is selected the area
 ' will be empty, i.e., its coordinates will all be -1.

 Set MyArea = MyScreen.Selection

 MyString$ = MyString$ + "Left = " + Str$(MyArea.Left)

 MyString$ = MyString$ + "; Right = " + Str$(MyArea.Right)

 MyString$ = MyString$ + "; Top = " + Str$(MyArea.Top)

 MyString$ = MyString$ + "; Bottom = " + Str$(MyArea.Bottom)

 MsgBox MyString$

End Sub