Consultor Eletrônico



Kbase P14931: Dynamics 2.0A: Dynamic Viewer - Images and colours not rende
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/03/2003
Status: Unverified

SYMPTOM(s):

Dynamics 2.0A: Dynamic Viewer - Images and colours not rendered

CAUSE:

Saving the dynamic viewer which contains the images, buttons with image
or background colour of the frame is not supported in the AppBuilder for
the Dynamics 2.0A.

FIX:

Once the image or button widget is placed in the dynamic viewer,
the code can be created in the viewer's super procedure which will
load the images for the image widget and button widget and set the
frame's background colour.
In the definition section put this code:
DEFINE VARIABLE gcAllFieldNames AS CHARACTER NO-UNDO.
DEFINE VARIABLE gcAllFieldHandles AS CHARACTER NO-UNDO.
DEFINE VARIABLE hImage AS HANDLE NO-UNDO.
DEFINE VARIABLE hFrame AS HANDLE NO-UNDO.
DEFINE VARIABLE hbDynButton AS HANDLE NO-UNDO.

Create new function:
FUNCTION getFieldHandle RETURNS WIDGET-HANDLE
( INPUT pcFieldName AS CHARACTER ) :
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/

DEFINE VARIABLE iFieldPos AS INTEGER NO-UNDO.

iFieldPos = LOOKUP (pcFieldName, gcAllFieldNames).

RETURN (IF iFieldPos > 0 THEN
WIDGET-HANDLE(ENTRY(iFieldPos, gcAllFieldHandles)) ELSE ?).

Create override "initializeObject" procedure with the following code :

PROCEDURE initializeObject :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/

RUN SUPER.

{get AllFieldNames gcAllFieldNames}.
{get AllFieldHandles gcAllFieldHandles}.

hImage = DYNAMIC-FUNCTION('getFieldHandle':U IN THIS-PROCEDURE, 'IMAGE-1').

hFrame = hImage:FRAME.

hbDynButton = DYNAMIC-FUNCTION('getFieldHandle':U IN THIS-PROCEDURE, 'bDynButton').

hImage:LOAD-IMAGE("adeicon/dynbutt.ico") .
hbDynButton:LOAD-IMAGE("adeicon/dynbutt.ico") .
ASSIGN hFrame:BGCOLOR = 14 .

END PROCEDURE.

Make sure that you change the reference in your code
as the image widget in this example was placed with the name "IMAGE-1"
and button with the name "bDynButton".