Kbase P186424: Disabled "View Design" option and class inheritance error opening a ABL form in the Visual Designer
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  22/04/2011 |
|
Status: Unverified
SYMPTOM(s):
Class error opening a ABL form in the Visual Designer
The error is "Only classes that inherit from System.Windows.Forms.Control can be opened in the visual designer"
With the preprocessor code added the "View Design" option is grayed out from the context menu.
FACT(s) (Environment):
Preprocessors have been added to the class file for example:
&IF "{&WINDOW-SYSTEM}" = "TTY"
&THEN
CLASS MyForm:
END CLASS.
&ELSE
USING Progress.Lang.*.
USING Progress.Windows.Form.
ROUTINE-LEVEL ON ERROR UNDO, THROW.
CLASS MyForm INHERITS Form:
.
.
.
.
.
END CLASS.
&ENDIF
The preprocessors have been added to allow the class to compile in character sessions on UNIX. The idea being to avoid any compilation errors when compiling Windows specific source code.
Windows
OpenEdge 10.2x
CAUSE:
The code that subsequently opens the form in the Architect and Visual Designer does not use the preprocessors and does not evaluate them. Subsequently the code wrapped in the preprocessors, is changing the inheritance of the class. With this particular code the first statement in the class that is read is "CLASS MyForm" without any inheritance, and this is the reason the "View Design" option is disabled and there is an error opening the class in the Visual Designer.
FIX:
To correct the problem there are three options:
1. Reverse the order of the preprocessor code so that the real implementation of the class is first. For example:
&IF "{&WINDOW-SYSTEM}" NE "TTY"
&THEN
USING Progress.Lang.*.
USING Progress.Windows.Form.
ROUTINE-LEVEL ON ERROR UNDO, THROW.
CLASS MyForm INHERITS Form:
.
.
.
.
.
END CLASS.
&ELSE
CLASS MyForm:
END CLASS.
&ENDIF
2. Remove the preprocessors from the code and exclude Windows specific source code from UNIX compilations.
3. Remove the preprocessors from the code and separate the class into two separate classes, allowing the instantiating procedure to choose which class to run.