Try OpenEdge Now
skip to main content
GUI for .NET Primer
Controls in Forms : Working with .NET forms and controls
 

Working with .NET forms and controls

In the code example that follows, the first line defines an object reference for a form as the Progress.Windows.Form class. The Form class is contained in the Progress.Windows namespace, as shown:
DEFINE VARIABLE FormObjectRef AS Progress.Windows.Form       NO-UNDO.
DEFINE VARIABLE helloBtn      AS System.Windows.Forms.Button NO-UNDO.

ASSIGN
  FormObjectRef = NEW Progress.Windows.Form( )
  helloBtn      = NEW System.Windows.Forms.Button( )
  helloBtn:Text = "Hello World".

FormObjectRef:Controls:Add(helloBtn).
MESSAGE helloBtn:Text VIEW-AS ALERT-BOX.
In this example two .NET objects are created, one for a form (FormObjectRef) and one for a .NET button (helloBtn). The NEW statement is used to create an instance of the .NET form and button objects and assign them to variables. The "Hello World" string is assigned to the button's Text property. Finally, the helloBtn button object is added to the form's control collection. Even though helloBtn is a .NET object, it can be used in ABL, for example displaying its property in a MESSAGE statement. The fact that helloBtn is a .NET object is transparent when working in ABL.