Consultor Eletrônico



Kbase P89425: SELF use in ADM2 Programming
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   27/07/2004
Status: Unverified

GOAL:

SELF use in ADM2 Programming

FIX:

A handle to the object or widget associated with the currently executing user-interface trigger or event procedure.

Example:

DEFINE BUTTON b_quit LABEL "Quit"
 TRIGGERS:
   ON CHOOSE QUIT.
 END.

DEFINE VARIABLE x AS CHAR INIT "MOVE ME".

DEFINE FRAME move
 x NO-LABEL
 WITH SIZE 80 BY 10 TITLE "Move/Resize Widget".

ASSIGN x:MOVABLE = TRUE
      x:SELECTABLE = TRUE.

DEFINE FRAME butt-frame
 b_quit
 WITH CENTERED ROW SCREEN-LINES - 1.
 
ON END-MOVE OF x IN FRAME move
 DISPLAY
   SELF:FRAME-ROW
   SELF:FRAME-COL
   WITH FRAME end-info CENTERED ROW 14 TITLE "End Position".
    
ON START-MOVE OF x IN FRAME move
 DISPLAY
   SELF:FRAME-ROW
   SELF:FRAME-COL
   WITH FRAME info CENTERED ROW 12 TITLE "Start Position".    
 
ENABLE b_quit WITH FRAME butt-frame.
DISPLAY x WITH FRAME move.
ENABLE x WITH FRAME move.

WAIT-FOR CHOOSE OF b_quit IN FRAME butt-frame FOCUS x.

You can reference the SELF handle only within a user-interface trigger or the event procedure for an ActiveX control or asynchronous remote request.

In user-interface triggers, SELF is not automatically the widget that has input focus. To give input focus to the widget referenced by SELF, you must apply the ENTRY event to SELF within the trigger block. Note that you must do this for fill-in widgets whose AUTO-ZAP attribute you want to set, as in this fragment.

DEFINE VARIABLE fname AS CHARACTER FORMAT "x(30)" LABEL "Name".
DEFINE FRAME FillFrame fname WITH SIDE-LABELS.

ON ENTRY OF fname IN FRAME FillFrame DO:
   APPLY "ENTRY" TO SELF.
   SELF:AUTO-ZAP = TRUE.
END.
This makes SELF = FOCUS, which allows the new AUTO-ZAP value to take effect. For more information on the AUTO-ZAP attribute, see the  "Attributes and Methods Reference" section in this manual.

In the event procedure of an asynchronous remote request or in the context of a procedure called directly or indirectly by this event procedure, SELF returns the associated asynchronous request handle.

In the event procedure of an ActiveX control, SELF returns the control-frame widget handle and the COM-SELF system handle returns the control-frame COM-HANDLE value.

If referenced within a READ-RESPONSE event procedure, then SELF is the socket handle associated with the connection that received the message. If referenced within the CONNECT event procedure, then SELF is the server socket handle.