Public Window MainWindow
Title = "MainWindow"
Frame = (200, 200, 640, 480)
Control Label lbl_Address
Text = "Label"
Frame = (16, 16, 120, 20)
End Control
Control TextArea ta_Address
Text = "TextArea"
Frame = (136, 16, 300, 200)
End Control
End Window
Public Class GlobalVars
Public Property x_MainWindow As MainWindow
End Class
Class btn_ChangeAddress Inherits Button
Handle Action()
If GlobalVars.x_MainWindow IsNot Nothing Then
GlobalVars.x_MainWindow.lbl_Address.Text = "Your Address:"
GlobalVars.x_MainWindow.ta_Address.Text = "Your Address"
End If
End Handle
End Class
Sub Main()
Dim w As New MainWindow()
GlobalVars.x_MainWindow = w
' Set initial values
w.lbl_Address.Text = "My Address:"
w.ta_Address.Text = "My Address"
' Create button and capture window reference
Dim b As New btn_ChangeAddress()
b.Caption = "Change to Address"
b.Move(136, 224, 300, 32)
b.target_window = w ' â
Pass the window reference
w.AddSubview(b)
w.Show()
Application.Run()
End Sub
in the above code, I am setting the value for labels and textarea to âMy Addressâ and when I click on the button, want it to change to âYour Addressâ
the error I got is as follows
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: class 'btn_ChangeAddress' has no field 'target_window'
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: undefined variable 'Nothing'
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: unknown member 'lbl_Address' on type Unknown
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: unknown member 'lbl_Address' on type Unknown
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
error: unknown member 'lbl_Address' on type Unknown
error: unknown member 'Text' on type Unknown
error: class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
unknown member 'ta_Address' on type Unknown
class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
unknown member 'ta_Address' on type Unknown
class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
class 'GlobalVars' has no shared member, constant, nested enum, or nested structure 'x_MainWindow'
unknown member 'ta_Address' on type Unknown
unknown member 'Text' on type Unknown