Home > Language Reference > Classes > UIComponent

ComponentToScreen Method

Converts coordinates relative to a component into coordinates relative to the screen.

Syntax

Public Sub ComponentToScreen(ByRef x As Integer, ByRef y As Integer)

ParameterDescription
xX-coordinate to convert.
yY-coordinate to convert.

Remarks

The ComponentToScreen method converts the x and y coordinates relative to the top left corner of the component into coordinates relative to the top left corner of the screen.

The reciprocal conversion is possible using the ScreenToComponent method. These two methods are often used together to convert coordinates relative to one component into coordinates relative to another component.

The example below illustrates this by converting coordinates relative to a Button control into coordinates relative to the form on which it is found:

Private Sub Button1_PenDown(ByVal x As Integer, ByVal y As Integer)
  Button1.ComponentToScreen x, y
  Me.ScreenToComponent x, y

  ' code using x and y

End Sub

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A