| Frank Swarbrick 2007-01-09, 7:55 am |
| <wesley_3@hotmail.com> 01/08/07 1:25 PM >>>
>Frank Swarbrick wrote:
>
>Frank, thanks for the input. I finally got it to work. I didn't have
>the Enum statements set up correctly in the Repository. The following
>is what I ended up using.
>
>REPOSITORY.
> CLASS CLASS-MESSAGEBOX AS "System.Windows.Forms.MessageBox"
> ENUM ENUM-MBBUTTON AS
>"System.Windows.Forms.MessageBoxButtons"
> ENUM ENUM-DIALOGRESULT AS
>"System.Windows.Forms.DialogResult"
> PROPERTY PROP-YESNO AS "YesNo"
> PROPERTY PROP-YES AS "Yes"
> .
>
>WORKING-STORAGE SECTION.
> 01 MB-YESNO OBJECT REFERENCE ENUM-MBBUTTON.
> 01 RET-VAL OBJECT REFERENCE ENUM-DIALOGRESULT.
> 01 DIALOGRESULTYES OBJECT REFERENCE ENUM-DIALOGRESULT.
>
>
>PROCEDURE DIVISION.
>
> SET MB-YESNO TO PROP-YESNO OF ENUM-MBBUTTON.
> SET DIALOGRESULTYES TO PROP-YES OF ENUM-DIALOGRESULT.
> INVOKE CLASS-MESSAGEBOX "Show" USING "Text" "Caption"
>MB-YESNO RETURNING RET-VAL.
> IF RET-VAL = DIALOGRESULTYES
> *> User chose yes
> ELSE
> *> User chose no
> END-IF.
Sounds good. I think with Micro Focus both enums and delegates are
considered to be classes, so they are specified with the class-specifier in
the repository.
For what its worth, I think you could eliminate MB-YESNO and DIALOGRESULTYES
and simply have:
WORKING-STORAGE SECTION.
01 RET-VAL OBJECT REFERENCE ENUM-DIALOGRESULT.
PROCEDURE DIVISION.
INVOKE CLASS-MESSAGEBOX "Show" USING "Text" "Caption" PROP-YESNO
OF ENUM-MBBUTTON
RETURNING RET-VAL.
IF RET-VAL = PROP-YES OF ENUM-DIALOGRESULT
*> User chose yes
ELSE
*> User chose no
END-IF.
Just a personal preference, but I prefer to have as few temporary fields as
possible. (Which is why I would also use an inline invoke, here, instead of
INVOKE with RETURNING into a temporary field.)
PROCEDURE DIVISION.
IF CLASS-MESSAGEBOX::"Show"( "Text" "Caption" PROP-YESNO OF
ENUM-MBBUTTON)
= PROP-YES OF ENUM-DIALOGRESULT
*> User chose yes
ELSE
*> User chose no
END-IF.
Perhaps I was corrupted by too much C programming in my wayward youth. :-)
On a related matter, are Micro Focus Net Express and Fujitsu NetCOBOL for
..NET the only two Cobol compilers that work with .NET?
Just wondering.
Frank
---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
|