Access .NET forms using the SESSION system handle
- Last Updated: June 19, 2019
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
For GUI clients, ABL maintains a .NET form
chain on the SESSION system handle
that is analogous to the ABL window chain. This form chain links
all .NET forms that you create in a session that are based
on the OpenEdge form class, Progress.Windows.Form.
The form chain is anchored to the SESSION handle
at each end using the FIRST-FORM and LAST-FORM attributes. You can then use
the NextForm and PrevForm properties
on the Progress.Windows.Form class
to walk the form chain similar to how you use the NEXT-SIBLING and PREV-SIBLING attributes to walk the ABL
window chain.
However, note that the FIRST-FORM and LAST-FORM attributes
actually have the Progress.Windows.IForm interface
type, which Progress.Windows.Form implements. This
interface defines the NextForm and PrevForm properties
used to walk this chain so you can more naturally use .NET forms
and ABL windows together. Thus, you can use this rIForm interface
reference in the following example to walk the form chain:
|
The iterative DO block
in this example walks the chain looking for instances of Progress.Windows.Form.
If this procedure is part of an application that also uses ABL windows,
there can be a different type of form object on this chain (Progress.Windows.FormProxy)
that is used to access these ABL windows. Thus, for each valid rIForm reference
in the chain, if it cannot be cast to a Progress.Windows.Form,
the ABL built-in CAST function returns
the Unknown value (?). Otherwise, the cast succeeds, allowing
the MESSAGE statement to display the Text property
of an appropriate form object. For more information on using .NET forms
with ABL windows, see Use .NET forms with ABL windows
Note also that .NET forms, like all classes, appear on the session object chain anchored by the FIRST-OBJECT and LAST-OBJECT attributes of the SESSION system handle. So, you can also navigate them together with other class-based objects in an ABL session.
System.Windows.Forms.Form does
not implement Progress.Windows.IForm,
if you use System.Windows.Forms.Form to create .NET forms in
an ABL session, the form objects appear only on the session
object chain. You also cannot use these native Microsoft form objects
as a parent or child of an ABL window. For more information, see Use .NET forms with ABL windows for more information.