PreviousNextIndex

Progress.Windows.UserControl class


(Windows only; GUI for .NET only)

A control container class that lets you combine and use a set of user-defined controls as a single control in ABL.

Constructors

PUBLIC UserControl( ) 

Super Class

System.Windows.Forms.UserControl class (from the .NET Framework)

Interfaces

This class does not implement interfaces (beyond those it inherits from its base class).

Public
Properties


This class does not contain properties (beyond those it inherits from its base class).

Public
Methods


This class does not contain methods (beyond those it inherits from its base class).

Public
Events


This class does not contain events (beyond those it inherits from its base class).

Example

The following example shows a simple class that creates a user control container that contains a text box and a button:

USING System.Windows.Forms.* FROM ASSEMBLY. 
CLASS DemoUserControl INHERITS Progress.Windows.UserControl: 
  
/* Variable for text box and button in control container */ 
  DEFINE PRIVATE VARIABLE TextBox AS TextBox. 
  DEFINE PRIVATE VARIABLE OkBtn   AS Button. 
  CONSTRUCTOR DemoUserControl ( ): 
    InitializeComponents( ). 
  END CONSTRUCTOR. 
  METHOD PRIVATE VOID InitializeComponents( ): 
    /* Instantiate text box and button classes */ 
    TextBox   = NEW TextBox ( ). 
    OkBtn     = NEW Button ( ). 
    /* Set the text of the button, and text box */ 
    TextBox:Text = "Enter text here". 
    OkBtn:Text   = "OK". 
    /* Set the size and location of the container and controls */ 
    THIS-OBJECT:Size   = NEW System.Drawing.Size(200, 200). 
    TextBox:Location = NEW System.Drawing.Point(15, 20). 
    OkBtn:Size       = NEW System.Drawing.Size(30, 20). 
    OkBtn:Location   = NEW System.Drawing.Point(125, 20). 
    /* Add the text box and button controls to the container */ 
    THIS-OBJECT:Controls:Add(TextBox).  
    THIS-OBJECT:Controls:Add(OkBtn). 
  END METHOD. 
END CLASS. 

The following class instantiates this user control and adds it to a form:

USING System.Windows.Forms.* FROM ASSEMBLY. 
CLASS DemoUserControlForm INHERITS Progress.Windows.Form: 
  /* Variable for text box and button in control container */ 
  DEFINE PRIVATE VARIABLE rUserControl AS DemoUserControl. 
  CONSTRUCTOR DemoUserControlForm ( ): 
    InitializeComponents( ). 
  END CONSTRUCTOR. 
  /* Display and wait for this modal form to close. The caller blocks at a 
     call to this method */ 
  METHOD PUBLIC VOID Wait ( ): 
    WAIT-FOR Application:Run (THIS-OBJECT). 
  END METHOD. 
  
  METHOD PRIVATE VOID InitializeComponents( ): 
    /* Instantiate user control */ 
    rUserControl = NEW DemoUserControl ( ). 
    /* Set the text of the form title, button, and text box */ 
    THIS-OBJECT:Text = "This is my form". 
    /* Set the location of the user control */ 
    rUserControl:Location = NEW System.Drawing.Point(15, 20). 
    /* Add the user control to the form */ 
    THIS-OBJECT:Controls:Add (rUserControl).  
  END METHOD. 
END CLASS. 

To instantiate DemoUserControlForm and display the form with the user control, you can run a procedure that contains the following code:

DEFINE VARIABLE rMyUIForm AS CLASS DemoUserControlForm. 
rMyUIForm = NEW DemoUserControlForm(). 
rMyUIForm:Wait(). 

For more examples, see the chapter on creating and using forms and controls in OpenEdge Development: GUI for .NET Programming.

Notes
See also

Progress.Windows.Form class


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex