Hi, is ti possible to have a button with an imagen and when I click on antoher object/gadget (listbrowser entry) to change such image in the button?
Alas now everything I tried didn't work, 'cos I'm doing something wrong or missing a step. Or not underdtanding autodocs at all.
It shows IMAGE.PNG ok on the button, but how the modify sucg image-button with IMAGE2,.PNG and (re)show it?
One of my try/test is:
Thanks In Advance
#define OBJ(x) Objects[x] ... PAGE_Add, OBJ(OBJ_GEN) = IIntuition->NewObject(NULL, "layout.gadget", ... LAYOUT_AddChild, OBJ( OBJ_PREVIEW_BTN) = IIntuition->NewObject(NULL, "button.gadget", GA_ID, OBJ_PREVIEW_BTN, GA_RelVerify, TRUE, GA_Underscore, 0, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_RenderImage, OBJ(OBJ_PREVIEW_IMG) = IIntuition->NewObject(NULL, "bitmap.image", IA_Width, 256, IA_Height, 224, BITMAP_SourceFile, "IMAGE.PNG", BITMAP_Screen, screen, TAG_DONE), TAG_DONE), CHILD_MaxWidth, 256, // pixels width of preview CHILD_WeightedHeight, 0, // align image at top ... if( (pwindow = (struct Window *)IIntuition->IDoMethod(OBJ(OBJ_MAIN), WM_OPEN, NULL)) ) ...
... case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { ... case OBJ_CHANGE_IMG: // Remove image-button (but nothing happens) :-( if( OBJ(OBJ_PREVIEW_IMG) ) { IIntuition->IDoMethod(OBJ(OBJ_GEN), LM_REMOVECHILD, pwindow, OBJ(OBJ_PREVIEW_IMG) ); OBJ(OBJ_PREVIEW_IMG) = NULL; } OBJ(OBJ_PREVIEW_IMG) = IIntuition->NewObject(NULL, "bitmap.image", IA_Width, 256, IA_Height, 224, BITMAP_SourceFile, "IMAGE2.PNG", BITMAP_Screen, screen, TAG_DONE); IIntuition->IDoMethod(OBJ(OBJ_PREVIEW_BTN), LM_ADDCHILD, pwindow, OBJ(OBJ_PREVIEW_IMG), NULL); IIntuition->IDoMethod(OBJ(OBJ_MAIN), WM_RETHINK); break; } ...