Consultor Eletrônico



Kbase P15613: How to initiate "add record" with a button defined in DynVie
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/01/2003
Status: Unverified

GOAL:

How to initiate "add record" with a button defined in DynView?

FACT(s) (Environment):

Dynamics 2.0A

FIX:

1. open DynView with AppBuilder and add a button in it.
2. add a super procedure to your DynView.
3. create initializeObject in DynView super procedure
PROCEDURE initializeObject:
RUN SUPER.
/* to get the handle of my button */
DEF VAR vcTemp AS CHARACTER.
DEF VAR vi AS INTEGER.
vcTemp = DYNAMIC-FUNCTION('getAllFieldHandles':U IN TARGET-PROCEDURE) .

/* hBut has to be defined as handle in definitions section */
hBut_block :
DO vi = 1 TO NUM-ENTRIES( vcTemp ):
hBut = WIDGET-HANDLE( ENTRY( vi, vcTemp ) ).
IF VALID-HANDLE( hBut )
AND hBUT:TYPE = "BUTTON"
AND hBUT:LABEL = "Add Record"
THEN DO:
/* VERY IMPORTANT: now set the trigger */
ON "CHOOSE" OF hBut PERSISTENT RUN addRecord IN TARGET-PROCEDURE.
LEAVE hBut_block.
END.
END.
END PROCEDURE.
4. Add disableFields just to have "Add Record" button enable all the
time.
PROCEDURE disableFields:
DEFINE INPUT PARAMETER pcFieldType AS CHARACTER NO-UNDO.
/* Code placed here will execute PRIOR to standard behavior. */
RUN SUPER( INPUT pcFieldType).
/* Code placed here will execute AFTER standard behavior. */
IF VALID-HANDLE( hBut ) THEN
hBUT:SENSITIVE = TRUE.
END PROCEDURE