Hi All,
I have a little problem while creating dynamics buttons, as i want to assign "dynamically" bitmaps to the dynamically created buttons.
So i have a scoped-define TOOLBAR which holds the buttons to create, they are the same as the bitmap file to load.
Then i run the procedure to create the buttons in their own widget pool, and assign images to the created buttons. But at this stage i get next error :
*** IMAGE UP is not a setable attribute for button widget (4052)
Quid ? When i look at the attributes list of a button, then IMAGE-UP en IMAGE-DOWN as also IMAGE are attributes of the button-widget type, when created statically (see code beneath) it works,
/* STATIC EXAMPLE BEGINS */
DEFINE BUTTON Btn_save
IMAGE-UP FILE "save-u":U
IMAGE-DOWN FILE "save-d":U
IMAGE-INSENSITIVE FILE "save-i":U
LABEL "Save"
SIZE 5.14 BY 1.58.
/* STATIC EXAMPLE ENDS */
but created dynamically it doesn't ?
/* DYNAMIC EXAMPLE BEGINS */
/* scoped */
&SCOPED-DEFINE TOOLBAR ADD,COPYREC,DELETE,SAVEREC,RESET,CANCEL
/* main-block */
RUN prcToolbar IN THIS-PROCEDURE (INPUT 1 /*row*/, 1 /*col*/).
/* prcToolbar */
DEF INPUT PARAM iRow AS INT NO-UNDO.
DEF INPUT PARAM iCol AS INT NO-UNDO.
DEF VAR iNumBtns AS INT NO-UNDO.
DEF VAR cImageFile AS CHAR NO-UNDO.
DELETE WIDGET-POOL "ToolBar" NO-ERROR.
CREATE WIDGET-POOL "ToolBar" PERSISTENT.
DO iNumBtns = 1 TO NUM-ENTRIES("{&TOOLBAR}":U):
ASSIGN
iCol = iCol + 5.
cImageFile = "icons/":U + ENTRY(iNumBtns,"{&TOOLBAR}":U) + ".bmp":U.
CREATE BUTTON hCurBtn IN WIDGET-POOL "ToolBar"
ASSIGN
LABEL = ENTRY(iNumBtns,"{&TOOLBAR}":U)
ROW = iRow
COLUMN = iCol
WIDTH = 4
HEIGHT = 1.13
FRAME = FRAME DEFAULT-FRAME:HANDLE
SENSITIVE = TRUE
VISIBLE = TRUE
IMAGE-UP = cImageFile
IMAGE-DOWN = cImageFile
TRIGGERS:
/*
ON CHOOSE PERSISTENT RUN <someproc> IN THIS-PROCEDURE (INPUT hCurBtn).
*/
END TRIGGERS.
/* DYNAMIC EXAMPLE ENDS */
Thanx for Any Response !
Emmanuel.
I have a little problem while creating dynamics buttons, as i want to assign "dynamically" bitmaps to the dynamically created buttons.
So i have a scoped-define TOOLBAR which holds the buttons to create, they are the same as the bitmap file to load.
Then i run the procedure to create the buttons in their own widget pool, and assign images to the created buttons. But at this stage i get next error :
*** IMAGE UP is not a setable attribute for button widget (4052)
Quid ? When i look at the attributes list of a button, then IMAGE-UP en IMAGE-DOWN as also IMAGE are attributes of the button-widget type, when created statically (see code beneath) it works,
/* STATIC EXAMPLE BEGINS */
DEFINE BUTTON Btn_save
IMAGE-UP FILE "save-u":U
IMAGE-DOWN FILE "save-d":U
IMAGE-INSENSITIVE FILE "save-i":U
LABEL "Save"
SIZE 5.14 BY 1.58.
/* STATIC EXAMPLE ENDS */
but created dynamically it doesn't ?
/* DYNAMIC EXAMPLE BEGINS */
/* scoped */
&SCOPED-DEFINE TOOLBAR ADD,COPYREC,DELETE,SAVEREC,RESET,CANCEL
/* main-block */
RUN prcToolbar IN THIS-PROCEDURE (INPUT 1 /*row*/, 1 /*col*/).
/* prcToolbar */
DEF INPUT PARAM iRow AS INT NO-UNDO.
DEF INPUT PARAM iCol AS INT NO-UNDO.
DEF VAR iNumBtns AS INT NO-UNDO.
DEF VAR cImageFile AS CHAR NO-UNDO.
DELETE WIDGET-POOL "ToolBar" NO-ERROR.
CREATE WIDGET-POOL "ToolBar" PERSISTENT.
DO iNumBtns = 1 TO NUM-ENTRIES("{&TOOLBAR}":U):
ASSIGN
iCol = iCol + 5.
cImageFile = "icons/":U + ENTRY(iNumBtns,"{&TOOLBAR}":U) + ".bmp":U.
CREATE BUTTON hCurBtn IN WIDGET-POOL "ToolBar"
ASSIGN
LABEL = ENTRY(iNumBtns,"{&TOOLBAR}":U)
ROW = iRow
COLUMN = iCol
WIDTH = 4
HEIGHT = 1.13
FRAME = FRAME DEFAULT-FRAME:HANDLE
SENSITIVE = TRUE
VISIBLE = TRUE
IMAGE-UP = cImageFile
IMAGE-DOWN = cImageFile
TRIGGERS:
/*
ON CHOOSE PERSISTENT RUN <someproc> IN THIS-PROCEDURE (INPUT hCurBtn).
*/
END TRIGGERS.
/* DYNAMIC EXAMPLE ENDS */
Thanx for Any Response !
Emmanuel.