Consultor Eletrônico



Kbase P84319: How to define customized images for the button of a SmartPanel
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/06/2004
Status: Unverified

GOAL:

How to define customized images for the button of a SmartPanel

FACT(s) (Environment):

Progress 9.x

FIX:

You can achieve this by using the following code:

A) At container level (this will change only in the current container):

  1- Write an internal procedure called SetButtonsImages like:

DEFINE VARIABLE iNumObjects AS INTEGER NO-UNDO.
DEFINE VARIABLE cObjects AS CHARACTER NO-UNDO.
DEFINE VARIABLE hObject AS HANDLE NO-UNDO.

ASSIGN cObjects = DYNAMIC-FUNCTION('getEnabledObjHdls':U IN h_pupdsav).

DO iNumObjects = 1 TO NUM-ENTRIES(cObjects):

hObject = WIDGET-HANDLE(ENTRY(iNumObjects, cObjects)).

IF hObject:TYPE = "BUTTON":U THEN

CASE hObject:NAME:

WHEN 'btn-save':U THEN
hObject:LOAD-IMAGE("adm2\image\saverec.bmp").

WHEN 'Btn-Reset':U THEN
hObject:LOAD-IMAGE("adm2\image\update.bmp").

WHEN 'Btn-Add':U THEN
hObject:LOAD-IMAGE("adm2\image\add.bmp").

WHEN 'Btn-Copy':U THEN
hObject:LOAD-IMAGE("adm2\image\copyrec.bmp").

WHEN 'Btn-Delete':U THEN
hObject:LOAD-IMAGE("adm2\image\delete.bmp").

WHEN 'Btn-Cancel':U THEN
hObject:LOAD-IMAGE("adm2\image\cancel.bmp").

END CASE.
END.

END PROCEDURE.


  2- Call this procedure in an override of initializeObject, after the RUN SUPER.

B) If you want to change the label for all the smartPanel used in all containers:

  1-  Copy the specified smartPanel file in a propath location, so you can override it.
  2-  Create an internal procedure called SetButtonsImages like the one above.
  3-  Modify the line:

   ASSIGN cObjects = DYNAMIC-FUNCTION('getEnabledObjHdls':U IN h_pupdsav).
in:

   ASSIGN cObjects = DYNAMIC-FUNCTION('getEnabledObjHdls':U IN THIS-PROCEDURE).
  4-  Add, in initializeObject internal procedure, a RUN SetButtonsImages after the RUN SUPER.