Consultor Eletrônico



Kbase P111400: Sample OO4GL code to implement a GUI Window
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/10/2008
Status: Verified

GOAL:

Sample code to implement a GUI Window using OO4GL

FACT(s) (Environment):

OpenEdge 10.1x

FIX:

/* ******************** CWindow.cls file BEGIN ****************** */
/* CLASS CWindow implements a simple GUI Window
* See testCWnd.p code for details on how to call this class
*/
CLASS CWindow:
DEFINE PRIVATE BUTTON b1 LABEL "OK" size 20 by 2.
DEFINE PRIVATE VARIABLE c-win as HANDLE.
DEFINE PRIVATE VARIABLE caller as HANDLE.

DEFINE PRIVATE FRAME fx
b1
WITH SIDE-LABELS THREE-D .
DEFINE FRAME fx
b1 AT ROW 4.1 COL 19 WIDGET-ID 2
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 80 BY 16 WIDGET-ID 100.
ON CHOOSE OF b1 IN FRAME fx
DO:
message program-name(1) view-as alert-box.
END.
CONSTRUCTOR PUBLIC Cwindow ( ph as handle ):

caller = ph.

IF SESSION:DISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW C-Win ASSIGN
HIDDEN = YES
TITLE = "<insert window title>"
HEIGHT = 16
WIDTH = 80
MAX-HEIGHT = 16
MAX-WIDTH = 80
VIRTUAL-HEIGHT = 16
VIRTUAL-WIDTH = 80
RESIZE = yes
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
KEEP-FRAME-Z-ORDER = yes
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE c-win = CURRENT-WINDOW.
ASSIGN CURRENT-WINDOW = C-Win
caller:CURRENT-WINDOW = C-Win
&nb.sp; .
END CONSTRUCTOR.

DESTRUCTOR PUBLIC Cwindow ( ):
END DESTRUCTOR.

METHOD PUBLIC VOID runMe():

VIEW C-Win.
VIEW FRAME fx.
ENABLE b1 WITH FRAME fx.

wait-for close of frame fx.


END METHOD.
END CLASS.
/* ******************** CWindow.cls file END ****************** */

/* ******************* testCWnd.p file BEGIN ********************/
DEFINE VARIABLE cls as Cwindow.
cls = NEW Cwindow( THIS-PROCEDURE:HANDLE ).
cls:runMe().
/* ******************* testCWnd.p file END ********************/


.